summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2014-08-27 17:52:46 +0200
committerJorim Jaggi <jjaggi@google.com>2014-08-28 13:10:12 +0200
commit746f7facf2c5f9a7362387806b5926b951bb024a (patch)
tree7998223dd375262d937388adf2ecef19ee44147f /packages
parentd757d6bfc6cc20ab08f6e6f278d4404609ebc61a (diff)
downloadframeworks_base-746f7facf2c5f9a7362387806b5926b951bb024a.zip
frameworks_base-746f7facf2c5f9a7362387806b5926b951bb024a.tar.gz
frameworks_base-746f7facf2c5f9a7362387806b5926b951bb024a.tar.bz2
Start intent chooser after Keyguard is gone
If we have an intent chooser on the camera intent, we need to launch it after the Keyguard is fully gone because the ResolveActivity would finish itself if it is launched behind the Keyguard. Bug: 16570873 Change-Id: I2fdb4975fa0a6510e8853c6042383089570ec1f5
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java23
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java19
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java3
7 files changed, 51 insertions, 25 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index df005a8..35ed3e5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -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 */);
}
}
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..9dfbb27 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java
@@ -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);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
index 1d87ce3..62552b2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
@@ -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));
}
}
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 788d5ce..9fd3d9c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -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 {
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 e041de0..b6792f5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
@@ -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) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index 3338f6a..b4e2d57 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -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.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java
index 0586a83..acb4827 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java
@@ -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);
}
};