From 531db46112ac067efbc509910d1578d7b8a9d119 Mon Sep 17 00:00:00 2001 From: Patrick Baumann Date: Tue, 13 Feb 2018 13:01:47 -0800 Subject: Fixes go to web behavior for Instant Apps SysUI launches the installer with an ACTION_VIEW, CATEGORY_BROWSABLE intent that has no data defined to indicate that the user has chosen to go to the browser. A recent change to be more strict about what type of intent is allowed to launch the installer broke this behavior and is fixed by this change. We allow the special case in addition to the install and resolve actions. Bug: 73007515 Test: manual - launched instant app and tapped go to web Change-Id: Ifc386018db3c7a6a0ed0a045adb972f0f8d9c667 --- .../com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java | 7 ++++--- services/core/java/com/android/server/am/ActivityStarter.java | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java index 6444cc816663..747a551defe6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java @@ -575,7 +575,7 @@ public class PhoneStatusBarPolicy implements Callback, Callbacks, Intent browserIntent = getTaskIntent(taskId, userId); Notification.Builder builder = new Notification.Builder(mContext, NotificationChannels.GENERAL); - if (browserIntent != null) { + if (browserIntent != null && browserIntent.isWebIntent()) { // Make sure that this doesn't resolve back to an instant app browserIntent.setComponent(null) .setPackage(null) @@ -597,8 +597,9 @@ public class PhoneStatusBarPolicy implements Callback, Callbacks, .addCategory("unique:" + System.currentTimeMillis()) .putExtra(Intent.EXTRA_PACKAGE_NAME, appInfo.packageName) .putExtra(Intent.EXTRA_VERSION_CODE, (int) (appInfo.versionCode & 0x7fffffff)) - .putExtra(Intent.EXTRA_VERSION_CODE, appInfo.versionCode) - .putExtra(Intent.EXTRA_EPHEMERAL_FAILURE, pendingIntent); + .putExtra(Intent.EXTRA_LONG_VERSION_CODE, appInfo.versionCode) + .putExtra(Intent.EXTRA_EPHEMERAL_FAILURE, pendingIntent) + .putExtra(Intent.EXTRA_INSTANT_APP_FAILURE, pendingIntent); PendingIntent webPendingIntent = PendingIntent.getActivity(mContext, 0, goToWebIntent, 0); Action webAction = new Notification.Action.Builder(null, mContext.getString(R.string.go_to_web), diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java index 055b89b6a6f0..8aa67b96f56e 100644 --- a/services/core/java/com/android/server/am/ActivityStarter.java +++ b/services/core/java/com/android/server/am/ActivityStarter.java @@ -930,6 +930,7 @@ class ActivityStarter { // Don't modify the client's object! intent = new Intent(intent); if (componentSpecified + && !(Intent.ACTION_VIEW.equals(intent.getAction()) && intent.getData() == null) && !Intent.ACTION_INSTALL_INSTANT_APP_PACKAGE.equals(intent.getAction()) && !Intent.ACTION_RESOLVE_INSTANT_APP_PACKAGE.equals(intent.getAction()) && mService.getPackageManagerInternalLocked() -- cgit v1.2.3-59-g8ed1b