use of com.android.keyguard.KeyguardHostView.OnDismissAction in project platform_frameworks_base by android.
the class PhoneStatusBar method executeRunnableDismissingKeyguard.
public void executeRunnableDismissingKeyguard(final Runnable runnable, final Runnable cancelAction, final boolean dismissShade, final boolean afterKeyguardGone, final boolean deferred) {
final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing();
dismissKeyguardThenExecute(new OnDismissAction() {
@Override
public boolean onDismiss() {
AsyncTask.execute(new Runnable() {
@Override
public void run() {
try {
if (keyguardShowing && !afterKeyguardGone) {
ActivityManagerNative.getDefault().keyguardWaitingForActivityDrawn();
}
if (runnable != null) {
runnable.run();
}
} catch (RemoteException e) {
}
}
});
if (dismissShade) {
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true, /* force */
true);
}
return deferred;
}
}, cancelAction, afterKeyguardGone);
}
use of com.android.keyguard.KeyguardHostView.OnDismissAction in project platform_frameworks_base by android.
the class BaseStatusBar method startPendingIntentDismissingKeyguard.
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(null, 0, null, null, null, null, getActivityOptions());
} 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);
visibilityChanged(false);
return true;
}
}, afterKeyguardGone);
}
use of com.android.keyguard.KeyguardHostView.OnDismissAction in project platform_frameworks_base by android.
the class BaseStatusBar method startNotificationGutsIntent.
private void startNotificationGutsIntent(final Intent intent, final int appUid) {
final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing();
dismissKeyguardThenExecute(new OnDismissAction() {
@Override
public boolean onDismiss() {
AsyncTask.execute(new Runnable() {
public void run() {
try {
if (keyguardShowing) {
ActivityManagerNative.getDefault().keyguardWaitingForActivityDrawn();
}
TaskStackBuilder.create(mContext).addNextIntentWithParentStack(intent).startActivities(getActivityOptions(), new UserHandle(UserHandle.getUserId(appUid)));
overrideActivityPendingAppTransition(keyguardShowing);
} catch (RemoteException e) {
}
}
});
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true);
return true;
}
}, false);
}
use of com.android.keyguard.KeyguardHostView.OnDismissAction in project android_frameworks_base by DirtyUnicorns.
the class PhoneStatusBar method executeRunnableDismissingKeyguard.
public void executeRunnableDismissingKeyguard(final Runnable runnable, final Runnable cancelAction, final boolean dismissShade, final boolean afterKeyguardGone, final boolean deferred) {
final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing();
dismissKeyguardThenExecute(new OnDismissAction() {
@Override
public boolean onDismiss() {
AsyncTask.execute(new Runnable() {
@Override
public void run() {
try {
if (keyguardShowing && !afterKeyguardGone) {
ActivityManagerNative.getDefault().keyguardWaitingForActivityDrawn();
}
if (runnable != null) {
runnable.run();
}
} catch (RemoteException e) {
}
}
});
if (dismissShade) {
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true, /* force */
true);
}
return deferred;
}
}, cancelAction, afterKeyguardGone);
}
use of com.android.keyguard.KeyguardHostView.OnDismissAction in project android_frameworks_base by DirtyUnicorns.
the class BaseStatusBar method startPendingIntentDismissingKeyguard.
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(null, 0, null, null, null, null, getActivityOptions());
} 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);
visibilityChanged(false);
return true;
}
}, afterKeyguardGone);
}
Aggregations