diff options
| author | Adrian Roos <roosa@google.com> | 2015-09-24 23:25:48 +0000 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2015-09-24 23:25:48 +0000 |
| commit | fe7ceca1acdbcde6449f57bb19b45f8c948cc1f5 (patch) | |
| tree | a8c829a903ffcefefe2d6abdf323d0509322db2e /packages/SystemUI/src | |
| parent | 5ebe8e26f2c9517ce321a0fbcbed6efe2960da47 (diff) | |
| parent | 9ceec2f0f007e05ed2842f222b4f652bdd69eb3f (diff) | |
| download | frameworks_base-fe7ceca1acdbcde6449f57bb19b45f8c948cc1f5.zip frameworks_base-fe7ceca1acdbcde6449f57bb19b45f8c948cc1f5.tar.gz frameworks_base-fe7ceca1acdbcde6449f57bb19b45f8c948cc1f5.tar.bz2 | |
am 9ceec2f0: am f6c75158: am 12c54dfa: am c9f7abe3: Merge "DO NOT MERGE Send next alarm\'s show intent via PendingIntent" into lmp-dev
* commit '9ceec2f0f007e05ed2842f222b4f652bdd69eb3f':
DO NOT MERGE Send next alarm's show intent via PendingIntent
Diffstat (limited to 'packages/SystemUI/src')
4 files changed, 57 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 8a03a2b..c1a11f15 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -1528,6 +1528,58 @@ public abstract class BaseStatusBar extends SystemUI implements return new NotificationClicker(intent, notificationKey, forHun); } + public void startPendingIntentDismissingKeyguard(final PendingIntent intent) { + if (!isDeviceProvisioned()) return; + + final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing(); + final boolean afterKeyguardGone = intent.isActivity() + && PreviewInflater.wouldLaunchResolverActivity(mContext, intent.getIntent(), + mCurrentUserId); + dismissKeyguardThenExecute(new OnDismissAction() { + public boolean onDismiss() { + new Thread() { + @Override + public void run() { + try { + if (keyguardShowing && !afterKeyguardGone) { + ActivityManagerNative.getDefault() + .keyguardWaitingForActivityDrawn(); + } + + // The intent we are sending is for the application, which + // won't have permission to immediately start an activity after + // the user switches to home. We know it is safe to do at this + // point, so make sure new activity switches are now allowed. + ActivityManagerNative.getDefault().resumeAppSwitches(); + } catch (RemoteException e) { + } + + try { + intent.send(); + } catch (PendingIntent.CanceledException e) { + // the stack trace isn't very helpful here. + // Just log the exception message. + Log.w(TAG, "Sending intent failed: " + e); + + // TODO: Dismiss Keyguard. + } + if (intent.isActivity()) { + overrideActivityPendingAppTransition(keyguardShowing + && !afterKeyguardGone); + } + } + }.start(); + + // close the shade if it was open + animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, + true /* force */); + visibilityChanged(false); + + return true; + } + }, afterKeyguardGone); + } + protected class NotificationClicker implements View.OnClickListener { private PendingIntent mIntent; private final String mNotificationKey; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java index 23810f9..62bf84d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.phone; +import android.app.PendingIntent; import android.content.Intent; /** @@ -24,5 +25,6 @@ import android.content.Intent; * Keyguard. */ public interface ActivityStarter { + void startPendingIntentDismissingKeyguard(PendingIntent intent); public void startActivity(Intent intent, boolean dismissShade); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java index 45a1386..9aa7022 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.phone; +import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.res.Resources; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java index 181926c..cbb4309 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java @@ -498,8 +498,8 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL startBatteryActivity(); } else if (v == mAlarmStatus && mNextAlarm != null) { PendingIntent showIntent = mNextAlarm.getShowIntent(); - if (showIntent != null && showIntent.isActivity()) { - mActivityStarter.startActivity(showIntent.getIntent(), true /* dismissShade */); + if (showIntent != null) { + mActivityStarter.startPendingIntentDismissingKeyguard(showIntent); } } } |
