summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-10-04 18:07:30 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-10-04 18:07:30 +0000
commit795fe024094de4d384b5cd1bada3f673796caabd (patch)
treee9fe352929355d913b115b19dc3a4cd131d6828d
parent1e7944eb8a0045004fa3b0cfa88a45dd137187cf (diff)
parent4061a4f8c43af068200cf81f31a3e7f64806cece (diff)
downloadPackageInstaller-795fe024094de4d384b5cd1bada3f673796caabd.tar.gz
Merge cherrypicks of [14130214] into rvc-platform-release. am: 4061a4f8c4
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/PackageInstaller/+/19662901 Change-Id: I21241f80a35b432756880897b417417ab2a277b5 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--res/layout/grant_permissions.xml22
-rw-r--r--src/com/android/permissioncontroller/permission/ui/handheld/widget/SecureButton.java53
2 files changed, 64 insertions, 11 deletions
diff --git a/res/layout/grant_permissions.xml b/res/layout/grant_permissions.xml
index e7458079b..3bcc379b3 100644
--- a/res/layout/grant_permissions.xml
+++ b/res/layout/grant_permissions.xml
@@ -63,52 +63,52 @@
<Space
style="@style/PermissionGrantButtonBarSpace"/>
- <Button
+ <com.android.permissioncontroller.permission.ui.widget.SecureButton
android:id="@+id/permission_allow_button"
android:text="@string/grant_dialog_button_allow"
style="@style/PermissionGrantButtonAllow" />
- <Button
+ <com.android.permissioncontroller.permission.ui.widget.SecureButton
android:id="@+id/permission_allow_always_button"
android:text="@string/grant_dialog_button_allow_always"
style="@style/PermissionGrantButtonAllowAlways" />
- <Button
+ <com.android.permissioncontroller.permission.ui.widget.SecureButton
android:id="@+id/permission_allow_foreground_only_button"
android:text="@string/grant_dialog_button_allow_foreground"
style="@style/PermissionGrantButtonAllowForeground" />
- <Button
+ <com.android.permissioncontroller.permission.ui.widget.SecureButton
android:id="@+id/permission_allow_one_time_button"
android:text="@string/grant_dialog_button_allow_one_time"
style="@style/PermissionGrantButtonAllowOneTime" />
- <Button
+ <com.android.permissioncontroller.permission.ui.widget.SecureButton
android:id="@+id/permission_deny_button"
android:text="@string/grant_dialog_button_deny"
style="@style/PermissionGrantButtonDeny" />
- <Button
+ <com.android.permissioncontroller.permission.ui.widget.SecureButton
android:id="@+id/permission_deny_and_dont_ask_again_button"
android:text="@string/grant_dialog_button_deny"
style="@style/PermissionGrantButtonDeny" />
- <Button
+ <com.android.permissioncontroller.permission.ui.widget.SecureButton
android:id="@+id/permission_no_upgrade_button"
android:text="@string/grant_dialog_button_no_upgrade"
style="@style/PermissionGrantButtonNoUpgrade" />
- <Button
+ <com.android.permissioncontroller.permission.ui.widget.SecureButton
android:id="@+id/permission_no_upgrade_and_dont_ask_again_button"
android:text="@string/grant_dialog_button_no_upgrade"
style="@style/PermissionGrantButtonNoUpgrade" />
- <Button
+ <com.android.permissioncontroller.permission.ui.widget.SecureButton
android:id="@+id/permission_no_upgrade_one_time_button"
android:text="@string/grant_dialog_button_no_upgrade_one_time"
style="@style/PermissionGrantButtonNoUpgrade" />
- <Button
+ <com.android.permissioncontroller.permission.ui.widget.SecureButton
android:id="@+id/permission_no_upgrade_one_time_and_dont_ask_again_button"
android:text="@string/grant_dialog_button_no_upgrade_one_time"
style="@style/PermissionGrantButtonNoUpgrade" />
@@ -116,4 +116,4 @@
</LinearLayout>
</LinearLayout>
-</ScrollView> \ No newline at end of file
+</ScrollView>
diff --git a/src/com/android/permissioncontroller/permission/ui/handheld/widget/SecureButton.java b/src/com/android/permissioncontroller/permission/ui/handheld/widget/SecureButton.java
new file mode 100644
index 000000000..20025d0ee
--- /dev/null
+++ b/src/com/android/permissioncontroller/permission/ui/handheld/widget/SecureButton.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.permissioncontroller.permission.ui.widget;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.widget.Button;
+
+/**
+ * A button which doesn't allow clicking when any part of the window is obscured
+ */
+public class SecureButton extends Button {
+
+ private static final int FLAGS_WINDOW_IS_OBSCURED =
+ MotionEvent.FLAG_WINDOW_IS_OBSCURED | MotionEvent.FLAG_WINDOW_IS_PARTIALLY_OBSCURED;
+
+ public SecureButton(Context context) {
+ super(context);
+ }
+
+ public SecureButton(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public SecureButton(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ public SecureButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ }
+
+ @Override
+ public boolean onFilterTouchEventForSecurity(MotionEvent event) {
+ return (event.getFlags() & FLAGS_WINDOW_IS_OBSCURED) == 0
+ && super.onFilterTouchEventForSecurity(event);
+ }
+}