DO NOT MERGE Disable overlays while installer is resumed
The install button can be disabled for other reasons, hence we have to
store the enabled state independent of the resumed/paused state.
Test: gts-tradefed run gts-dev -m PackageInstallerTapjacking
Bug: 35056974
Change-Id: I2effa0f5afacfaed217a030550a778e32912cfbb
diff --git a/PermissionController/src/com/android/packageinstaller/PackageInstallerActivity.java b/PermissionController/src/com/android/packageinstaller/PackageInstallerActivity.java
index 6bcd80e..6887598 100644
--- a/PermissionController/src/com/android/packageinstaller/PackageInstallerActivity.java
+++ b/PermissionController/src/com/android/packageinstaller/PackageInstallerActivity.java
@@ -16,7 +16,6 @@
*/
package com.android.packageinstaller;
-import android.app.Activity;
import android.app.ActivityManagerNative;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -52,6 +51,8 @@
import android.widget.TabHost;
import android.widget.TextView;
+import com.android.packageinstaller.permission.ui.OverlayTouchActivity;
+
import java.io.File;
import java.util.List;
@@ -65,7 +66,8 @@
* Based on the user response the package is then installed by launching InstallAppConfirm
* sub activity. All state transitions are handled in this activity
*/
-public class PackageInstallerActivity extends Activity implements OnCancelListener, OnClickListener {
+public class PackageInstallerActivity extends OverlayTouchActivity implements OnCancelListener,
+ OnClickListener {
private static final String TAG = "PackageInstaller";
private int mSessionId = -1;
@@ -563,6 +565,25 @@
}
}
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ if (mOk != null) {
+ mOk.setEnabled(mOkCanInstall);
+ }
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+
+ if (mOk != null) {
+ // Don't allow the install button to be clicked as there might be overlays
+ mOk.setEnabled(false);
+ }
+ }
+
/** Get the ApplicationInfo for the calling package, if available */
private ApplicationInfo getSourceInfo() {
String callingPackage = getCallingPackage();