summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Roos <roosa@google.com>2015-09-11 17:46:23 -0700
committerThe Android Automerger <android-build@google.com>2015-10-27 15:22:29 -0700
commit0ddfa0e90075039dfee500accb308a089d1c71ea (patch)
tree2ae30667925fb63697e6e72f5727abbf40a70223
parentc02a10d8b626469ea64babebfd88fb96ea9ececf (diff)
downloadbase-0ddfa0e90075039dfee500accb308a089d1c71ea.tar.gz
Send next alarm's show intent via PendingIntent
Also send all IntentTile intents via PendingIntent. Bug: 23909438 Change-Id: I0bb277c8385b7936fbda03cd76f02248c4fc55de
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSTile.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java53
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java4
7 files changed, 75 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java
index b330582089c4..e4a37fbf1b2d 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java
@@ -16,6 +16,7 @@
package com.android.systemui.qs;
+import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Animatable;
@@ -320,6 +321,7 @@ public abstract class QSTile<TState extends State> implements Listenable {
public interface Host {
void startActivityDismissingKeyguard(Intent intent);
+ void startActivityDismissingKeyguard(PendingIntent intent);
void warn(String message, Throwable t);
void collapsePanels();
Looper getLooper();
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java
index 3d0dc7b5c1a2..c7f2284c07a6 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java
@@ -99,7 +99,7 @@ public class IntentTile extends QSTile<QSTile.State> {
try {
if (pi != null) {
if (pi.isActivity()) {
- getHost().startActivityDismissingKeyguard(pi.getIntent());
+ getHost().startActivityDismissingKeyguard(pi);
} else {
pi.send();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 79174c986063..490a8d8e9480 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -1495,6 +1495,59 @@ public abstract class BaseStatusBar extends SystemUI implements
return true;
}
+ 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()) {
+ mAssistManager.hideAssist();
+ overrideActivityPendingAppTransition(keyguardShowing
+ && !afterKeyguardGone);
+ }
+ }
+ }.start();
+
+ // close the shade if it was open
+ animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL,
+ true /* force */, true /* delayed */);
+ visibilityChanged(false);
+
+ return true;
+ }
+ }, afterKeyguardGone);
+ }
+
private final class NotificationClicker implements View.OnClickListener {
public void onClick(final View v) {
if (!(v instanceof ExpandableNotificationRow)) {
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 9ef320bc3fd9..8f689c6c00b3 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,6 +25,7 @@ import android.content.Intent;
* Keyguard.
*/
public interface ActivityStarter {
+ void startPendingIntentDismissingKeyguard(PendingIntent intent);
void startActivity(Intent intent, boolean dismissShade);
void startActivity(Intent intent, boolean dismissShade, Callback callback);
void preventNextAnimation();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index a661ae625fb8..5fd1a3a3f4f6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -3167,6 +3167,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
return !isDeviceProvisioned() || (mDisabled1 & StatusBarManager.DISABLE_SEARCH) != 0;
}
+ public void postStartActivityDismissingKeyguard(final PendingIntent intent) {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ startPendingIntentDismissingKeyguard(intent);
+ }
+ });
+ }
+
public void postStartActivityDismissingKeyguard(final Intent intent, int delay) {
mHandler.postDelayed(new Runnable() {
@Override
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 12434ac2af5b..e66c63b5c0ed 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;
@@ -134,6 +135,11 @@ public class QSTileHost implements QSTile.Host, Tunable {
}
@Override
+ public void startActivityDismissingKeyguard(PendingIntent intent) {
+ mStatusBar.postStartActivityDismissingKeyguard(intent);
+ }
+
+ @Override
public void warn(String message, Throwable t) {
// already logged
}
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 7ee47dff37e6..f8bc43fcbf2a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
@@ -520,8 +520,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);
}
}
}