* commit '8630e18a297801238efcba8760e8d850d8920a80': Send next alarm's show intent via PendingIntent
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.systemui.qs;
|
package com.android.systemui.qs;
|
||||||
|
|
||||||
|
import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.Animatable;
|
import android.graphics.drawable.Animatable;
|
||||||
@@ -320,6 +321,7 @@ public abstract class QSTile<TState extends State> implements Listenable {
|
|||||||
|
|
||||||
public interface Host {
|
public interface Host {
|
||||||
void startActivityDismissingKeyguard(Intent intent);
|
void startActivityDismissingKeyguard(Intent intent);
|
||||||
|
void startActivityDismissingKeyguard(PendingIntent intent);
|
||||||
void warn(String message, Throwable t);
|
void warn(String message, Throwable t);
|
||||||
void collapsePanels();
|
void collapsePanels();
|
||||||
Looper getLooper();
|
Looper getLooper();
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class IntentTile extends QSTile<QSTile.State> {
|
|||||||
try {
|
try {
|
||||||
if (pi != null) {
|
if (pi != null) {
|
||||||
if (pi.isActivity()) {
|
if (pi.isActivity()) {
|
||||||
getHost().startActivityDismissingKeyguard(pi.getIntent());
|
getHost().startActivityDismissingKeyguard(pi);
|
||||||
} else {
|
} else {
|
||||||
pi.send();
|
pi.send();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1490,6 +1490,59 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
return true;
|
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 {
|
private final class NotificationClicker implements View.OnClickListener {
|
||||||
public void onClick(final View v) {
|
public void onClick(final View v) {
|
||||||
if (!(v instanceof ExpandableNotificationRow)) {
|
if (!(v instanceof ExpandableNotificationRow)) {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.systemui.statusbar.phone;
|
package com.android.systemui.statusbar.phone;
|
||||||
|
|
||||||
|
import android.app.PendingIntent;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,6 +25,7 @@ import android.content.Intent;
|
|||||||
* Keyguard.
|
* Keyguard.
|
||||||
*/
|
*/
|
||||||
public interface ActivityStarter {
|
public interface ActivityStarter {
|
||||||
|
void startPendingIntentDismissingKeyguard(PendingIntent intent);
|
||||||
void startActivity(Intent intent, boolean dismissShade);
|
void startActivity(Intent intent, boolean dismissShade);
|
||||||
void startActivity(Intent intent, boolean dismissShade, Callback callback);
|
void startActivity(Intent intent, boolean dismissShade, Callback callback);
|
||||||
void preventNextAnimation();
|
void preventNextAnimation();
|
||||||
|
|||||||
@@ -3210,6 +3210,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
|||||||
return !isDeviceProvisioned() || (mDisabled1 & StatusBarManager.DISABLE_SEARCH) != 0;
|
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) {
|
public void postStartActivityDismissingKeyguard(final Intent intent, int delay) {
|
||||||
mHandler.postDelayed(new Runnable() {
|
mHandler.postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.systemui.statusbar.phone;
|
package com.android.systemui.statusbar.phone;
|
||||||
|
|
||||||
|
import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
@@ -133,6 +134,11 @@ public class QSTileHost implements QSTile.Host, Tunable {
|
|||||||
mStatusBar.postStartActivityDismissingKeyguard(intent, 0);
|
mStatusBar.postStartActivityDismissingKeyguard(intent, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startActivityDismissingKeyguard(PendingIntent intent) {
|
||||||
|
mStatusBar.postStartActivityDismissingKeyguard(intent);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void warn(String message, Throwable t) {
|
public void warn(String message, Throwable t) {
|
||||||
// already logged
|
// already logged
|
||||||
|
|||||||
@@ -527,8 +527,8 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
|
|||||||
startBatteryActivity();
|
startBatteryActivity();
|
||||||
} else if (v == mAlarmStatus && mNextAlarm != null) {
|
} else if (v == mAlarmStatus && mNextAlarm != null) {
|
||||||
PendingIntent showIntent = mNextAlarm.getShowIntent();
|
PendingIntent showIntent = mNextAlarm.getShowIntent();
|
||||||
if (showIntent != null && showIntent.isActivity()) {
|
if (showIntent != null) {
|
||||||
mActivityStarter.startActivity(showIntent.getIntent(), true /* dismissShade */);
|
mActivityStarter.startPendingIntentDismissingKeyguard(showIntent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user