summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip P. Moltmann <moltmann@google.com>2017-06-12 13:58:50 -0700
committerPhilip P. Moltmann <moltmann@google.com>2017-06-13 08:24:36 -0700
commiteeef073ecde8c1eb0296786a4dd8bfcfdc3cba4c (patch)
tree58f7a965f970fc697c1874ea77ae373b0aaa37fc
parent15436b4cc4bdfe99412a77dc06fc30ce23d3b00b (diff)
downloadandroid_packages_apps_PackageInstaller-eeef073ecde8c1eb0296786a4dd8bfcfdc3cba4c.tar.gz
android_packages_apps_PackageInstaller-eeef073ecde8c1eb0296786a4dd8bfcfdc3cba4c.tar.bz2
android_packages_apps_PackageInstaller-eeef073ecde8c1eb0296786a4dd8bfcfdc3cba4c.zip
Disable overlays while installer is resumed
The install button can be disabled for other reasons, hence we have to store the enabled state independant of the resumed/paused state. Test: gts-tradefed run gts-dev -m PackageInstallerTapjacking Fixes: 62239598 Change-Id: I2effa0f5afacfaed217a030550a778e32912cfbb
-rw-r--r--res/layout/install_confirm.xml1
-rw-r--r--res/layout/install_confirm_perm.xml1
-rw-r--r--res/layout/install_confirm_perm_update.xml1
-rw-r--r--src/com/android/packageinstaller/PackageInstallerActivity.java32
4 files changed, 27 insertions, 8 deletions
diff --git a/res/layout/install_confirm.xml b/res/layout/install_confirm.xml
index dc8b588e..8f10c15c 100644
--- a/res/layout/install_confirm.xml
+++ b/res/layout/install_confirm.xml
@@ -84,7 +84,6 @@
android:layout_height="wrap_content"
android:text="@string/next"
android:maxLines="2"
- android:filterTouchesWhenObscured="true"
style="?android:attr/buttonBarButtonStyle" />
</LinearLayout>
diff --git a/res/layout/install_confirm_perm.xml b/res/layout/install_confirm_perm.xml
index 5ba1b14e..048b69de 100644
--- a/res/layout/install_confirm_perm.xml
+++ b/res/layout/install_confirm_perm.xml
@@ -118,7 +118,6 @@
android:layout_height="wrap_content"
android:text="@string/next"
android:maxLines="2"
- android:filterTouchesWhenObscured="true"
style="?android:attr/buttonBarButtonStyle" />
</LinearLayout>
diff --git a/res/layout/install_confirm_perm_update.xml b/res/layout/install_confirm_perm_update.xml
index e9a4700b..7341897d 100644
--- a/res/layout/install_confirm_perm_update.xml
+++ b/res/layout/install_confirm_perm_update.xml
@@ -142,7 +142,6 @@
android:layout_height="wrap_content"
android:text="@string/next"
android:maxLines="2"
- android:filterTouchesWhenObscured="true"
style="?android:attr/buttonBarButtonStyle" />
</LinearLayout>
diff --git a/src/com/android/packageinstaller/PackageInstallerActivity.java b/src/com/android/packageinstaller/PackageInstallerActivity.java
index 4d33a3af..48f2f901 100644
--- a/src/com/android/packageinstaller/PackageInstallerActivity.java
+++ b/src/com/android/packageinstaller/PackageInstallerActivity.java
@@ -17,7 +17,6 @@
package com.android.packageinstaller;
import android.Manifest;
-import android.app.Activity;
import android.app.AlertDialog;
import android.app.AppGlobals;
import android.app.AppOpsManager;
@@ -57,6 +56,8 @@ import android.widget.Button;
import android.widget.TabHost;
import android.widget.TextView;
+import com.android.packageinstaller.permission.ui.OverlayTouchActivity;
+
import java.io.File;
/**
@@ -69,7 +70,7 @@ import java.io.File;
* 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 OnClickListener {
+public class PackageInstallerActivity extends OverlayTouchActivity implements OnClickListener {
private static final String TAG = "PackageInstaller";
private static final int REQUEST_TRUST_EXTERNAL_SOURCE = 1;
@@ -128,6 +129,9 @@ public class PackageInstallerActivity extends Activity implements OnClickListene
// If unknown sources are temporary allowed
private boolean mAllowUnknownSources;
+ // Would the mOk button be enabled if this activity would be resumed
+ private boolean mEnableOk;
+
private void startInstallConfirm() {
// We might need to show permissions, load layout with permissions
if (mAppInfo != null) {
@@ -442,6 +446,25 @@ public class PackageInstallerActivity extends Activity implements OnClickListene
}
@Override
+ protected void onResume() {
+ super.onResume();
+
+ if (mOk != null) {
+ mOk.setEnabled(mEnableOk);
+ }
+ }
+
+ @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);
+ }
+ }
+
+ @Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
@@ -456,9 +479,8 @@ public class PackageInstallerActivity extends Activity implements OnClickListene
mOk.setOnClickListener(this);
mCancel.setOnClickListener(this);
- if (!enableOk) {
- mOk.setEnabled(false);
- }
+ mEnableOk = enableOk;
+ mOk.setEnabled(enableOk);
PackageUtil.initSnippetForNewApp(this, mAppSnippet, R.id.app_snippet);
}