diff options
author | Anthony Hugh <ahugh@google.com> | 2015-10-28 16:46:15 -0700 |
---|---|---|
committer | Anthony Hugh <ahugh@google.com> | 2015-10-28 16:46:15 -0700 |
commit | e18bfc22019f44ae60674fc6d34616ce097e05f4 (patch) | |
tree | f931bb378c5bf4e632f6d8a0c6743f2a90002fd7 /src/com/android/packageinstaller/permission/ui/wear/WarningConfirmationActivity.java | |
parent | c70bf71517707e7b6d678f5d0a0c08d2ad91a68c (diff) | |
download | android_packages_apps_PackageInstaller-e18bfc22019f44ae60674fc6d34616ce097e05f4.tar.gz android_packages_apps_PackageInstaller-e18bfc22019f44ae60674fc6d34616ce097e05f4.tar.bz2 android_packages_apps_PackageInstaller-e18bfc22019f44ae60674fc6d34616ce097e05f4.zip |
Fix out of bounds exception
It looks like the cached index had become invalid at some
point. It's unclear why, but the logs suggest that a
bunch of Home services crashed.
Rather than cache the index within the Activity, I have
changed the code to send the index along with the
dialog activity launch. This way when the dialog returns,
the index will be saved within the callback.
The index should be enough because the permission set
should not change for the app between screens and the
permission set is alphabetized.
BUG: 25334674
Change-Id: I8f9189960aa7fc9b09cc25f594397523550ac626
Diffstat (limited to 'src/com/android/packageinstaller/permission/ui/wear/WarningConfirmationActivity.java')
-rw-r--r-- | src/com/android/packageinstaller/permission/ui/wear/WarningConfirmationActivity.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/com/android/packageinstaller/permission/ui/wear/WarningConfirmationActivity.java b/src/com/android/packageinstaller/permission/ui/wear/WarningConfirmationActivity.java index e26dabd6..03713419 100644 --- a/src/com/android/packageinstaller/permission/ui/wear/WarningConfirmationActivity.java +++ b/src/com/android/packageinstaller/permission/ui/wear/WarningConfirmationActivity.java @@ -17,6 +17,7 @@ package com.android.packageinstaller.permission.ui.wear; import android.app.Activity; +import android.content.Intent; import android.graphics.drawable.Drawable; import android.graphics.drawable.Icon; import android.os.Bundle; @@ -25,6 +26,8 @@ import com.android.packageinstaller.R; public final class WarningConfirmationActivity extends Activity { public final static String EXTRA_WARNING_MESSAGE = "EXTRA_WARNING_MESSAGE"; + // Saved index that will be returned in the onActivityResult() callback + public final static String EXTRA_INDEX = "EXTRA_INDEX"; private ConfirmationViewHandler mViewHandler; private String mMessage; @@ -43,14 +46,12 @@ public final class WarningConfirmationActivity extends Activity { @Override public void onButton1() { - setResult(Activity.RESULT_CANCELED); - finish(); + setResultAndFinish(Activity.RESULT_CANCELED); } @Override public void onButton2() { - setResult(Activity.RESULT_OK); - finish(); + setResultAndFinish(Activity.RESULT_OK); } @Override @@ -107,4 +108,11 @@ public final class WarningConfirmationActivity extends Activity { setContentView(mViewHandler.createView()); mViewHandler.invalidate(); } + + private void setResultAndFinish(int result) { + Intent intent = new Intent(); + intent.putExtra(EXTRA_INDEX, getIntent().getIntExtra(EXTRA_INDEX, -1)); + setResult(result, intent); + finish(); + } } |