am 0b198fa9: am 1c20d304: Start intent chooser after Keyguard is gone

* commit '0b198fa9d4151243fb98936c3b19e33b466fcc7b':
  Start intent chooser after Keyguard is gone
This commit is contained in:
Jorim Jaggi
2014-08-28 12:42:03 +00:00
committed by Android Git Automerger
7 changed files with 51 additions and 25 deletions

View File

@@ -276,7 +276,7 @@ public abstract class BaseStatusBar extends SystemUI implements
// Wait for activity start.
return handled;
}
});
}, false /* afterKeyguardGone */);
return true;
} else {
return super.onClickHandler(view, pendingIntent, fillInIntent);
@@ -526,8 +526,9 @@ public abstract class BaseStatusBar extends SystemUI implements
/**
* Takes the necessary steps to prepare the status bar for starting an activity, then starts it.
* @param action A dismiss action that is called if it's safe to start the activity.
* @param afterKeyguardGone Whether the action should be executed after the Keyguard is gone.
*/
protected void dismissKeyguardThenExecute(OnDismissAction action) {
protected void dismissKeyguardThenExecute(OnDismissAction action, boolean afterKeyguardGone) {
action.onDismiss();
}
@@ -646,7 +647,7 @@ public abstract class BaseStatusBar extends SystemUI implements
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE, true /* force */);
return true;
}
});
}, false /* afterKeyguardGone */);
}
protected SwipeHelper.LongPressListener getNotificationLongClicker() {
@@ -1339,7 +1340,7 @@ public abstract class BaseStatusBar extends SystemUI implements
return mIntent != null && mIntent.isActivity();
}
});
}, false /* afterKeyguardGone */);
}
}

View File

@@ -24,5 +24,5 @@ import android.content.Intent;
* Keyguard.
*/
public interface ActivityStarter {
public void startActivity(Intent intent, boolean dismissShade);
public void startActivity(Intent intent, boolean dismissShade, boolean afterKeyguardGone);
}

View File

@@ -315,11 +315,15 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
public void launchCamera() {
mFlashlightController.killFlashlight();
Intent intent = getCameraIntent();
if (intent == SECURE_CAMERA_INTENT &&
!mPreviewInflater.wouldLaunchResolverActivity(intent)) {
boolean wouldLaunchResolverActivity = mPreviewInflater.wouldLaunchResolverActivity(intent);
if (intent == SECURE_CAMERA_INTENT && !wouldLaunchResolverActivity) {
mContext.startActivityAsUser(intent, UserHandle.CURRENT);
} else {
mActivityStarter.startActivity(intent, false /* dismissShade */);
// We need to delay starting the activity because ResolverActivity finishes itself if
// launched behind lockscreen.
mActivityStarter.startActivity(intent, false /* dismissShade */,
wouldLaunchResolverActivity /* afterKeyguardGone */);
}
}
@@ -333,7 +337,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
}
});
} else {
mActivityStarter.startActivity(PHONE_INTENT, false /* dismissShade */);
mActivityStarter.startActivity(PHONE_INTENT, false /* dismissShade */,
mPreviewInflater.wouldLaunchResolverActivity(PHONE_INTENT));
}
}

View File

@@ -2039,8 +2039,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
@Override
public void startActivity(Intent intent, boolean dismissShade) {
startActivityDismissingKeyguard(intent, false, dismissShade);
public void startActivity(Intent intent, boolean dismissShade, boolean afterKeyguardGone) {
startActivityDismissingKeyguard(intent, false, dismissShade, afterKeyguardGone);
}
public ScrimController getScrimController() {
@@ -2929,7 +2929,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
public void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned,
final boolean dismissShade) {
final boolean dismissShade, final boolean afterKeyguardGone) {
if (onlyProvisioned && !isDeviceProvisioned()) return;
final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing();
@@ -2939,7 +2939,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
AsyncTask.execute(new Runnable() {
public void run() {
try {
if (keyguardShowing) {
if (keyguardShowing && !afterKeyguardGone) {
ActivityManagerNative.getDefault()
.keyguardWaitingForActivityDrawn();
}
@@ -2947,7 +2947,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
mContext.startActivityAsUser(
intent, new UserHandle(UserHandle.USER_CURRENT));
overrideActivityPendingAppTransition(keyguardShowing);
overrideActivityPendingAppTransition(
keyguardShowing && !afterKeyguardGone);
} catch (RemoteException e) {
}
}
@@ -2957,7 +2958,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
return true;
}
});
}, afterKeyguardGone);
}
private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@@ -3019,10 +3020,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
@Override
protected void dismissKeyguardThenExecute(final OnDismissAction action) {
protected void dismissKeyguardThenExecute(final OnDismissAction action,
boolean afterKeyguardGone) {
if (mStatusBarKeyguardViewManager.isShowing()) {
if (UnlockMethodCache.getInstance(mContext).isMethodInsecure()
&& mNotificationPanel.isLaunchTransitionRunning()) {
&& mNotificationPanel.isLaunchTransitionRunning() && !afterKeyguardGone) {
action.onDismiss();
mNotificationPanel.setLaunchTransitionEndRunnable(new Runnable() {
@Override
@@ -3031,7 +3033,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
});
} else {
mStatusBarKeyguardViewManager.dismissWithAction(action);
mStatusBarKeyguardViewManager.dismissWithAction(action, afterKeyguardGone);
}
} else {
action.onDismiss();
@@ -3270,7 +3272,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
private void handleStartSettingsActivity(Intent intent, boolean onlyProvisioned) {
startActivityDismissingKeyguard(intent, onlyProvisioned, true /* dismissShade */);
startActivityDismissingKeyguard(intent, onlyProvisioned, true /* dismissShade */,
false /* afterKeyguardGone */);
}
private static class FastColorDrawable extends Drawable {

View File

@@ -524,19 +524,20 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
} else if (v == mAlarmStatus && mNextAlarm != null) {
PendingIntent showIntent = mNextAlarm.getShowIntent();
if (showIntent != null && showIntent.isActivity()) {
mActivityStarter.startActivity(showIntent.getIntent(), true /* dismissShade */);
mActivityStarter.startActivity(showIntent.getIntent(), true /* dismissShade */,
false /* afterKeyguardGone */);
}
}
}
private void startSettingsActivity() {
mActivityStarter.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS),
true /* dismissShade */);
true /* dismissShade */, false /* afterKeyguardGone */);
}
private void startBatteryActivity() {
mActivityStarter.startActivity(new Intent(Intent.ACTION_POWER_USAGE_SUMMARY),
true /* dismissShade */);
true /* dismissShade */, false /* afterKeyguardGone */);
}
public void setQSPanel(QSPanel qsp) {

View File

@@ -65,6 +65,7 @@ public class StatusBarKeyguardViewManager {
private boolean mLastOccluded;
private boolean mLastBouncerShowing;
private boolean mLastBouncerDismissible;
private OnDismissAction mAfterKeyguardGoneAction;
public StatusBarKeyguardViewManager(Context context, ViewMediatorCallback callback,
LockPatternUtils lockPatternUtils) {
@@ -118,9 +119,14 @@ public class StatusBarKeyguardViewManager {
updateStates();
}
public void dismissWithAction(OnDismissAction r) {
public void dismissWithAction(OnDismissAction r, boolean afterKeyguardGone) {
if (mShowing) {
mBouncer.showWithDismissAction(r);
if (!afterKeyguardGone) {
mBouncer.showWithDismissAction(r);
} else {
mBouncer.show();
mAfterKeyguardGoneAction = r;
}
}
updateStates();
}
@@ -245,6 +251,7 @@ public class StatusBarKeyguardViewManager {
mPhoneStatusBar.hideKeyguard();
mStatusBarWindowManager.setKeyguardFadingAway(false);
mViewMediatorCallback.keyguardGone();
executeAfterKeyguardGoneAction();
}
});
} else {
@@ -266,11 +273,19 @@ public class StatusBarKeyguardViewManager {
mStatusBarWindowManager.setKeyguardShowing(false);
mBouncer.hide(true /* destroyView */);
mViewMediatorCallback.keyguardGone();
executeAfterKeyguardGoneAction();
updateStates();
}
}
private void executeAfterKeyguardGoneAction() {
if (mAfterKeyguardGoneAction != null) {
mAfterKeyguardGoneAction.onDismiss();
mAfterKeyguardGoneAction = null;
}
}
/**
* Dismisses the keyguard by going to the next screen or making it gone.
*/

View File

@@ -140,7 +140,8 @@ public class VolumeUI extends SystemUI {
@Override
public void run() {
getComponent(PhoneStatusBar.class).startActivityDismissingKeyguard(
ZenModePanel.ZEN_SETTINGS, true /* onlyProvisioned */, true /* dismissShade */);
ZenModePanel.ZEN_SETTINGS, true /* onlyProvisioned */, true /* dismissShade */,
false /* afterKeyguardGone */);
mPanel.postDismiss(mDismissDelay);
}
};