Merge "Use a protected receiver for the keyguard delayed actions" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
08d79be6bd
@@ -145,6 +145,8 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
private static final String DELAYED_LOCK_PROFILE_ACTION =
|
private static final String DELAYED_LOCK_PROFILE_ACTION =
|
||||||
"com.android.internal.policy.impl.PhoneWindowManager.DELAYED_LOCK";
|
"com.android.internal.policy.impl.PhoneWindowManager.DELAYED_LOCK";
|
||||||
|
|
||||||
|
private static final String SYSTEMUI_PERMISSION = "com.android.systemui.permission.SELF";
|
||||||
|
|
||||||
// used for handler messages
|
// used for handler messages
|
||||||
private static final int SHOW = 1;
|
private static final int SHOW = 1;
|
||||||
private static final int HIDE = 2;
|
private static final int HIDE = 2;
|
||||||
@@ -693,11 +695,15 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
mShowKeyguardWakeLock.setReferenceCounted(false);
|
mShowKeyguardWakeLock.setReferenceCounted(false);
|
||||||
|
|
||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
filter.addAction(DELAYED_KEYGUARD_ACTION);
|
|
||||||
filter.addAction(DELAYED_LOCK_PROFILE_ACTION);
|
|
||||||
filter.addAction(Intent.ACTION_SHUTDOWN);
|
filter.addAction(Intent.ACTION_SHUTDOWN);
|
||||||
mContext.registerReceiver(mBroadcastReceiver, filter);
|
mContext.registerReceiver(mBroadcastReceiver, filter);
|
||||||
|
|
||||||
|
final IntentFilter delayedActionFilter = new IntentFilter();
|
||||||
|
delayedActionFilter.addAction(DELAYED_KEYGUARD_ACTION);
|
||||||
|
delayedActionFilter.addAction(DELAYED_LOCK_PROFILE_ACTION);
|
||||||
|
mContext.registerReceiver(mDelayedLockBroadcastReceiver, delayedActionFilter,
|
||||||
|
SYSTEMUI_PERMISSION, null /* scheduler */);
|
||||||
|
|
||||||
mKeyguardDisplayManager = new KeyguardDisplayManager(mContext, mViewMediatorCallback);
|
mKeyguardDisplayManager = new KeyguardDisplayManager(mContext, mViewMediatorCallback);
|
||||||
|
|
||||||
mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
|
mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
|
||||||
@@ -1465,7 +1471,10 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
|
/**
|
||||||
|
* This broadcast receiver should be registered with the SystemUI permission.
|
||||||
|
*/
|
||||||
|
private final BroadcastReceiver mDelayedLockBroadcastReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
if (DELAYED_KEYGUARD_ACTION.equals(intent.getAction())) {
|
if (DELAYED_KEYGUARD_ACTION.equals(intent.getAction())) {
|
||||||
@@ -1487,7 +1496,14 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Intent.ACTION_SHUTDOWN.equals(intent.getAction())) {
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
if (Intent.ACTION_SHUTDOWN.equals(intent.getAction())) {
|
||||||
synchronized (KeyguardViewMediator.this){
|
synchronized (KeyguardViewMediator.this){
|
||||||
mShuttingDown = true;
|
mShuttingDown = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user