Merge "Exempt default_input_method from BG-FGS-start restriction." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
12ded20343
@@ -190,6 +190,8 @@ public class PowerExemptionManager {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static final int REASON_TEMP_ALLOWED_WHILE_IN_USE = 70;
|
public static final int REASON_TEMP_ALLOWED_WHILE_IN_USE = 70;
|
||||||
|
/** @hide */
|
||||||
|
public static final int REASON_CURRENT_INPUT_METHOD = 71;
|
||||||
|
|
||||||
/* BG-FGS-launch is allowed by temp-allow-list or system-allow-list.
|
/* BG-FGS-launch is allowed by temp-allow-list or system-allow-list.
|
||||||
Reason code for temp and system allow list starts here.
|
Reason code for temp and system allow list starts here.
|
||||||
@@ -381,6 +383,7 @@ public class PowerExemptionManager {
|
|||||||
REASON_ACTIVITY_VISIBILITY_GRACE_PERIOD,
|
REASON_ACTIVITY_VISIBILITY_GRACE_PERIOD,
|
||||||
REASON_OP_ACTIVATE_VPN,
|
REASON_OP_ACTIVATE_VPN,
|
||||||
REASON_OP_ACTIVATE_PLATFORM_VPN,
|
REASON_OP_ACTIVATE_PLATFORM_VPN,
|
||||||
|
REASON_CURRENT_INPUT_METHOD,
|
||||||
REASON_TEMP_ALLOWED_WHILE_IN_USE,
|
REASON_TEMP_ALLOWED_WHILE_IN_USE,
|
||||||
// temp and system allow list reasons.
|
// temp and system allow list reasons.
|
||||||
REASON_GEOFENCING,
|
REASON_GEOFENCING,
|
||||||
@@ -649,6 +652,8 @@ public class PowerExemptionManager {
|
|||||||
return "OP_ACTIVATE_VPN";
|
return "OP_ACTIVATE_VPN";
|
||||||
case REASON_OP_ACTIVATE_PLATFORM_VPN:
|
case REASON_OP_ACTIVATE_PLATFORM_VPN:
|
||||||
return "OP_ACTIVATE_PLATFORM_VPN";
|
return "OP_ACTIVATE_PLATFORM_VPN";
|
||||||
|
case REASON_CURRENT_INPUT_METHOD:
|
||||||
|
return "CURRENT_INPUT_METHOD";
|
||||||
case REASON_TEMP_ALLOWED_WHILE_IN_USE:
|
case REASON_TEMP_ALLOWED_WHILE_IN_USE:
|
||||||
return "TEMP_ALLOWED_WHILE_IN_USE";
|
return "TEMP_ALLOWED_WHILE_IN_USE";
|
||||||
case REASON_GEOFENCING:
|
case REASON_GEOFENCING:
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import static android.os.PowerExemptionManager.REASON_DENIED;
|
|||||||
import static android.os.PowerExemptionManager.REASON_DEVICE_DEMO_MODE;
|
import static android.os.PowerExemptionManager.REASON_DEVICE_DEMO_MODE;
|
||||||
import static android.os.PowerExemptionManager.REASON_DEVICE_OWNER;
|
import static android.os.PowerExemptionManager.REASON_DEVICE_OWNER;
|
||||||
import static android.os.PowerExemptionManager.REASON_FGS_BINDING;
|
import static android.os.PowerExemptionManager.REASON_FGS_BINDING;
|
||||||
|
import static android.os.PowerExemptionManager.REASON_CURRENT_INPUT_METHOD;
|
||||||
import static android.os.PowerExemptionManager.REASON_INSTR_BACKGROUND_ACTIVITY_PERMISSION;
|
import static android.os.PowerExemptionManager.REASON_INSTR_BACKGROUND_ACTIVITY_PERMISSION;
|
||||||
import static android.os.PowerExemptionManager.REASON_INSTR_BACKGROUND_FGS_PERMISSION;
|
import static android.os.PowerExemptionManager.REASON_INSTR_BACKGROUND_FGS_PERMISSION;
|
||||||
import static android.os.PowerExemptionManager.REASON_OPT_OUT_REQUESTED;
|
import static android.os.PowerExemptionManager.REASON_OPT_OUT_REQUESTED;
|
||||||
@@ -6162,6 +6163,20 @@ public final class ActiveServices {
|
|||||||
ret = REASON_OP_ACTIVATE_PLATFORM_VPN;
|
ret = REASON_OP_ACTIVATE_PLATFORM_VPN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ret == REASON_DENIED) {
|
||||||
|
final String inputMethod =
|
||||||
|
Settings.Secure.getStringForUser(mAm.mContext.getContentResolver(),
|
||||||
|
Settings.Secure.DEFAULT_INPUT_METHOD,
|
||||||
|
UserHandle.getUserId(callingUid));
|
||||||
|
if (inputMethod != null) {
|
||||||
|
final ComponentName cn = ComponentName.unflattenFromString(inputMethod);
|
||||||
|
if (cn != null && cn.getPackageName().equals(callingPackage)) {
|
||||||
|
ret = REASON_CURRENT_INPUT_METHOD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ret == REASON_DENIED) {
|
if (ret == REASON_DENIED) {
|
||||||
if (mAm.mConstants.mFgsAllowOptOut
|
if (mAm.mConstants.mFgsAllowOptOut
|
||||||
&& targetService != null
|
&& targetService != null
|
||||||
|
|||||||
Reference in New Issue
Block a user