summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip P. Moltmann <moltmann@google.com>2016-05-05 22:17:31 (GMT)
committerPhilip P. Moltmann <moltmann@google.com>2016-05-05 22:17:35 (GMT)
commit1dba1776c3fd432fd9adb5e3e251b6562aca7f3c (patch)
tree9aaa2ec9508c1153247935e0f1d90a71a76e543f
parent4cb02fd082ceceba2c73447f466032fce94108d8 (diff)
downloadandroid_packages_apps_PackageInstaller-1dba1776c3fd432fd9adb5e3e251b6562aca7f3c.zip
android_packages_apps_PackageInstaller-1dba1776c3fd432fd9adb5e3e251b6562aca7f3c.tar.gz
android_packages_apps_PackageInstaller-1dba1776c3fd432fd9adb5e3e251b6562aca7f3c.tar.bz2
Mend up onDestroy->onCreate for N.
This does not implement correct onDestroy->onCreate behavior but mends it for the common case. We now handle all configurations changes, hence onDestroy->onCreate is very rare. We also just abort quickly if we actually had a onDestroy->onCreate instead of crashing. This is a temporary fix. Bug: 28588511 Change-Id: Ief56c8b866f2561b13253f66a7f79517fc2132cb
-rw-r--r--AndroidManifest.xml2
-rwxr-xr-xsrc/com/android/packageinstaller/UninstallAppProgress.java29
2 files changed, 29 insertions, 2 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 8bfa28c..39e9f3c 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -73,7 +73,7 @@
</activity>
<activity android:name=".UninstallAppProgress"
- android:configChanges="orientation|keyboardHidden|screenSize"
+ android:configChanges="mnc|mnc|touchscreen|navigation|screenLayout|screenSize|smallestScreenSize|orientation|locale|keyboard|keyboardHidden|fontScale|uiMode|layoutDirection|density"
android:exported="false" />
<activity android:name=".permission.ui.GrantPermissionsActivity"
diff --git a/src/com/android/packageinstaller/UninstallAppProgress.java b/src/com/android/packageinstaller/UninstallAppProgress.java
index 0727633..008ce7c 100755
--- a/src/com/android/packageinstaller/UninstallAppProgress.java
+++ b/src/com/android/packageinstaller/UninstallAppProgress.java
@@ -27,6 +27,7 @@ import android.content.pm.IPackageManager;
import android.content.pm.PackageInstaller;
import android.content.pm.PackageManager;
import android.content.pm.UserInfo;
+import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
@@ -92,6 +93,10 @@ public class UninstallAppProgress extends Activity implements OnClickListener {
private Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
+ if (isFinishing() || isDestroyed()) {
+ return;
+ }
+
switch (msg.what) {
case UNINSTALL_IS_SLOW:
initView();
@@ -237,8 +242,31 @@ public class UninstallAppProgress extends Activity implements OnClickListener {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
+
Intent intent = getIntent();
mAppInfo = intent.getParcelableExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO);
+ mCallback = intent.getIBinderExtra(PackageInstaller.EXTRA_CALLBACK);
+
+ // This currently does not support going through a onDestroy->onCreate cycle. Hence if that
+ // happened, just fail the operation for mysterious reasons.
+ if (icicle != null) {
+ mResultCode = PackageManager.DELETE_FAILED_INTERNAL_ERROR;
+
+ if (mCallback != null) {
+ final IPackageDeleteObserver2 observer = IPackageDeleteObserver2.Stub
+ .asInterface(mCallback);
+ try {
+ observer.onPackageDeleted(mAppInfo.packageName, mResultCode, null);
+ } catch (RemoteException ignored) {
+ }
+ finish();
+ } else {
+ setResultAndFinish(mResultCode);
+ }
+
+ return;
+ }
+
mAllUsers = intent.getBooleanExtra(Intent.EXTRA_UNINSTALL_ALL_USERS, false);
if (mAllUsers && !UserManager.get(this).isAdminUser()) {
throw new SecurityException("Only admin user can request uninstall for all users");
@@ -254,7 +282,6 @@ public class UninstallAppProgress extends Activity implements OnClickListener {
+ "request uninstall for user " + mUser);
}
}
- mCallback = intent.getIBinderExtra(PackageInstaller.EXTRA_CALLBACK);
PackageDeleteObserver observer = new PackageDeleteObserver();