Start all resolver activities after keyguard is gone
Bug: 17417099 Change-Id: I30b154067b1c4cbca09af49a4763f9cf5fdc19e6
This commit is contained in:
@@ -91,6 +91,7 @@ import com.android.systemui.statusbar.NotificationData.Entry;
|
||||
import com.android.systemui.statusbar.phone.KeyguardTouchDelegate;
|
||||
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
|
||||
import com.android.systemui.statusbar.policy.HeadsUpNotificationView;
|
||||
import com.android.systemui.statusbar.policy.PreviewInflater;
|
||||
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -260,10 +261,12 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
final boolean isActivity = pendingIntent.isActivity();
|
||||
if (isActivity) {
|
||||
final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing();
|
||||
final boolean afterKeyguardGone = PreviewInflater.wouldLaunchResolverActivity(
|
||||
mContext, pendingIntent.getIntent(), mCurrentUserId);
|
||||
dismissKeyguardThenExecute(new OnDismissAction() {
|
||||
@Override
|
||||
public boolean onDismiss() {
|
||||
if (keyguardShowing) {
|
||||
if (keyguardShowing && !afterKeyguardGone) {
|
||||
try {
|
||||
ActivityManagerNative.getDefault()
|
||||
.keyguardWaitingForActivityDrawn();
|
||||
@@ -277,7 +280,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
}
|
||||
|
||||
boolean handled = superOnClickHandler(view, pendingIntent, fillInIntent);
|
||||
overrideActivityPendingAppTransition(keyguardShowing);
|
||||
overrideActivityPendingAppTransition(keyguardShowing && !afterKeyguardGone);
|
||||
|
||||
// close the shade if it was open
|
||||
if (handled) {
|
||||
@@ -287,7 +290,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
// Wait for activity start.
|
||||
return handled;
|
||||
}
|
||||
}, false /* afterKeyguardGone */);
|
||||
}, afterKeyguardGone);
|
||||
return true;
|
||||
} else {
|
||||
return super.onClickHandler(view, pendingIntent, fillInIntent);
|
||||
@@ -1440,6 +1443,9 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
|
||||
public void onClick(final View v) {
|
||||
final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing();
|
||||
final boolean afterKeyguardGone = mIntent.isActivity()
|
||||
&& PreviewInflater.wouldLaunchResolverActivity(mContext, mIntent.getIntent(),
|
||||
mCurrentUserId);
|
||||
dismissKeyguardThenExecute(new OnDismissAction() {
|
||||
public boolean onDismiss() {
|
||||
if (mIsHeadsUp) {
|
||||
@@ -1448,7 +1454,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
AsyncTask.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (keyguardShowing) {
|
||||
if (keyguardShowing && !afterKeyguardGone) {
|
||||
try {
|
||||
ActivityManagerNative.getDefault()
|
||||
.keyguardWaitingForActivityDrawn();
|
||||
@@ -1472,7 +1478,8 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
// TODO: Dismiss Keyguard.
|
||||
}
|
||||
if (mIntent.isActivity()) {
|
||||
overrideActivityPendingAppTransition(keyguardShowing);
|
||||
overrideActivityPendingAppTransition(keyguardShowing
|
||||
&& !afterKeyguardGone);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1490,7 +1497,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
|
||||
return mIntent != null && mIntent.isActivity();
|
||||
}
|
||||
}, false /* afterKeyguardGone */);
|
||||
}, afterKeyguardGone);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,5 +24,5 @@ import android.content.Intent;
|
||||
* Keyguard.
|
||||
*/
|
||||
public interface ActivityStarter {
|
||||
public void startActivity(Intent intent, boolean dismissShade, boolean afterKeyguardGone);
|
||||
public void startActivity(Intent intent, boolean dismissShade);
|
||||
}
|
||||
|
||||
@@ -315,15 +315,15 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
||||
public void launchCamera() {
|
||||
mFlashlightController.killFlashlight();
|
||||
Intent intent = getCameraIntent();
|
||||
boolean wouldLaunchResolverActivity = mPreviewInflater.wouldLaunchResolverActivity(intent);
|
||||
boolean wouldLaunchResolverActivity = PreviewInflater.wouldLaunchResolverActivity(
|
||||
mContext, intent, mLockPatternUtils.getCurrentUser());
|
||||
if (intent == SECURE_CAMERA_INTENT && !wouldLaunchResolverActivity) {
|
||||
mContext.startActivityAsUser(intent, UserHandle.CURRENT);
|
||||
} else {
|
||||
|
||||
// We need to delay starting the activity because ResolverActivity finishes itself if
|
||||
// launched behind lockscreen.
|
||||
mActivityStarter.startActivity(intent, false /* dismissShade */,
|
||||
wouldLaunchResolverActivity /* afterKeyguardGone */);
|
||||
mActivityStarter.startActivity(intent, false /* dismissShade */);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,8 +337,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mActivityStarter.startActivity(PHONE_INTENT, false /* dismissShade */,
|
||||
mPreviewInflater.wouldLaunchResolverActivity(PHONE_INTENT));
|
||||
mActivityStarter.startActivity(PHONE_INTENT, false /* dismissShade */);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -149,6 +149,7 @@ import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
|
||||
import com.android.systemui.statusbar.policy.LocationControllerImpl;
|
||||
import com.android.systemui.statusbar.policy.NetworkControllerImpl;
|
||||
import com.android.systemui.statusbar.policy.NextAlarmController;
|
||||
import com.android.systemui.statusbar.policy.PreviewInflater;
|
||||
import com.android.systemui.statusbar.policy.RotationLockControllerImpl;
|
||||
import com.android.systemui.statusbar.policy.SecurityControllerImpl;
|
||||
import com.android.systemui.statusbar.policy.UserInfoController;
|
||||
@@ -2067,8 +2068,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startActivity(Intent intent, boolean dismissShade, boolean afterKeyguardGone) {
|
||||
startActivityDismissingKeyguard(intent, false, dismissShade, afterKeyguardGone);
|
||||
public void startActivity(Intent intent, boolean dismissShade) {
|
||||
startActivityDismissingKeyguard(intent, false, dismissShade);
|
||||
}
|
||||
|
||||
public ScrimController getScrimController() {
|
||||
@@ -2957,9 +2958,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
}
|
||||
|
||||
public void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned,
|
||||
final boolean dismissShade, final boolean afterKeyguardGone) {
|
||||
final boolean dismissShade) {
|
||||
if (onlyProvisioned && !isDeviceProvisioned()) return;
|
||||
|
||||
final boolean afterKeyguardGone = PreviewInflater.wouldLaunchResolverActivity(
|
||||
mContext, intent, mCurrentUserId);
|
||||
final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing();
|
||||
dismissKeyguardThenExecute(new OnDismissAction() {
|
||||
@Override
|
||||
@@ -3308,8 +3311,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
}
|
||||
|
||||
private void handleStartSettingsActivity(Intent intent, boolean onlyProvisioned) {
|
||||
startActivityDismissingKeyguard(intent, onlyProvisioned, true /* dismissShade */,
|
||||
false /* afterKeyguardGone */);
|
||||
startActivityDismissingKeyguard(intent, onlyProvisioned, true /* dismissShade */);
|
||||
}
|
||||
|
||||
private static class FastColorDrawable extends Drawable {
|
||||
|
||||
@@ -497,20 +497,19 @@ 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 */,
|
||||
false /* afterKeyguardGone */);
|
||||
mActivityStarter.startActivity(showIntent.getIntent(), true /* dismissShade */);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void startSettingsActivity() {
|
||||
mActivityStarter.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS),
|
||||
true /* dismissShade */, false /* afterKeyguardGone */);
|
||||
true /* dismissShade */);
|
||||
}
|
||||
|
||||
private void startBatteryActivity() {
|
||||
mActivityStarter.startActivity(new Intent(Intent.ACTION_POWER_USAGE_SUMMARY),
|
||||
true /* dismissShade */, false /* afterKeyguardGone */);
|
||||
true /* dismissShade */);
|
||||
}
|
||||
|
||||
public void setQSPanel(QSPanel qsp) {
|
||||
|
||||
@@ -20,14 +20,12 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.keyguard.KeyguardActivityLauncher;
|
||||
import com.android.systemui.statusbar.phone.KeyguardPreviewContainer;
|
||||
|
||||
import java.util.List;
|
||||
@@ -107,20 +105,21 @@ public class PreviewInflater {
|
||||
return info;
|
||||
}
|
||||
|
||||
public boolean wouldLaunchResolverActivity(Intent intent) {
|
||||
PackageManager packageManager = mContext.getPackageManager();
|
||||
public static boolean wouldLaunchResolverActivity(Context ctx, Intent intent,
|
||||
int currentUserId) {
|
||||
PackageManager packageManager = ctx.getPackageManager();
|
||||
final List<ResolveInfo> appList = packageManager.queryIntentActivitiesAsUser(
|
||||
intent, PackageManager.MATCH_DEFAULT_ONLY, mLockPatternUtils.getCurrentUser());
|
||||
intent, PackageManager.MATCH_DEFAULT_ONLY, currentUserId);
|
||||
if (appList.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
ResolveInfo resolved = packageManager.resolveActivityAsUser(intent,
|
||||
PackageManager.MATCH_DEFAULT_ONLY | PackageManager.GET_META_DATA,
|
||||
mLockPatternUtils.getCurrentUser());
|
||||
PackageManager.MATCH_DEFAULT_ONLY | PackageManager.GET_META_DATA, currentUserId);
|
||||
return wouldLaunchResolverActivity(resolved, appList);
|
||||
}
|
||||
|
||||
private boolean wouldLaunchResolverActivity(ResolveInfo resolved, List<ResolveInfo> appList) {
|
||||
private static boolean wouldLaunchResolverActivity(
|
||||
ResolveInfo resolved, List<ResolveInfo> appList) {
|
||||
// If the list contains the above resolved activity, then it can't be
|
||||
// ResolverActivity itself.
|
||||
for (int i = 0; i < appList.size(); i++) {
|
||||
|
||||
@@ -140,8 +140,7 @@ public class VolumeUI extends SystemUI {
|
||||
@Override
|
||||
public void run() {
|
||||
getComponent(PhoneStatusBar.class).startActivityDismissingKeyguard(
|
||||
ZenModePanel.ZEN_SETTINGS, true /* onlyProvisioned */, true /* dismissShade */,
|
||||
false /* afterKeyguardGone */);
|
||||
ZenModePanel.ZEN_SETTINGS, true /* onlyProvisioned */, true /* dismissShade */);
|
||||
mPanel.postDismiss(mDismissDelay);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user