Don't access keyguard from instant apps.
Test: manual bug:109652548 Change-Id: Ife1302e39e4f71f66d032619068a7e0214856b32
This commit is contained in:
committed by
Svetoslav Ganov
parent
f5976be9f4
commit
e5a3125c1c
@@ -112,7 +112,7 @@ public class PhoneFallbackEventHandler implements FallbackEventHandler {
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_CALL: {
|
||||
if (getKeyguardManager().inKeyguardRestrictedInputMode() || dispatcher == null) {
|
||||
if (isNotInstantAppAndKeyguardRestricted(dispatcher)) {
|
||||
break;
|
||||
}
|
||||
if (event.getRepeatCount() == 0) {
|
||||
@@ -139,7 +139,7 @@ public class PhoneFallbackEventHandler implements FallbackEventHandler {
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_CAMERA: {
|
||||
if (getKeyguardManager().inKeyguardRestrictedInputMode() || dispatcher == null) {
|
||||
if (isNotInstantAppAndKeyguardRestricted(dispatcher)) {
|
||||
break;
|
||||
}
|
||||
if (event.getRepeatCount() == 0) {
|
||||
@@ -164,7 +164,7 @@ public class PhoneFallbackEventHandler implements FallbackEventHandler {
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_SEARCH: {
|
||||
if (getKeyguardManager().inKeyguardRestrictedInputMode() || dispatcher == null) {
|
||||
if (isNotInstantAppAndKeyguardRestricted(dispatcher)) {
|
||||
break;
|
||||
}
|
||||
if (event.getRepeatCount() == 0) {
|
||||
@@ -202,6 +202,11 @@ public class PhoneFallbackEventHandler implements FallbackEventHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isNotInstantAppAndKeyguardRestricted(KeyEvent.DispatcherState dispatcher) {
|
||||
return !mContext.getPackageManager().isInstantApp()
|
||||
&& (getKeyguardManager().inKeyguardRestrictedInputMode() || dispatcher == null);
|
||||
}
|
||||
|
||||
boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "up " + keyCode);
|
||||
@@ -238,7 +243,7 @@ public class PhoneFallbackEventHandler implements FallbackEventHandler {
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_CAMERA: {
|
||||
if (getKeyguardManager().inKeyguardRestrictedInputMode()) {
|
||||
if (isNotInstantAppAndKeyguardRestricted(dispatcher)) {
|
||||
break;
|
||||
}
|
||||
if (event.isTracking() && !event.isCanceled()) {
|
||||
@@ -248,7 +253,7 @@ public class PhoneFallbackEventHandler implements FallbackEventHandler {
|
||||
}
|
||||
|
||||
case KeyEvent.KEYCODE_CALL: {
|
||||
if (getKeyguardManager().inKeyguardRestrictedInputMode()) {
|
||||
if (isNotInstantAppAndKeyguardRestricted(dispatcher)) {
|
||||
break;
|
||||
}
|
||||
if (event.isTracking() && !event.isCanceled()) {
|
||||
|
||||
Reference in New Issue
Block a user