Loading AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -2500,7 +2500,7 @@ android:name="Settings$AppUsageAccessSettingsActivity" android:exported="true" android:label="@string/usage_access_title"> <intent-filter> <intent-filter android:priority="1"> <action android:name="android.settings.USAGE_ACCESS_SETTINGS"/> <category android:name="android.intent.category.DEFAULT"/> <data android:scheme="package"/> Loading src/com/android/settings/applications/AppInfoBase.java +20 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ import androidx.fragment.app.Fragment; import com.android.settings.SettingsActivity; import com.android.settings.SettingsPreferenceFragment; import com.android.settings.activityembedding.ActivityEmbeddingUtils; import com.android.settings.applications.manageapplications.ManageApplications; import com.android.settings.core.SubSettingLauncher; import com.android.settings.core.instrumentation.InstrumentedDialogFragment; Loading Loading @@ -178,6 +179,25 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment if (!(activity instanceof SettingsActivity)) { return false; } // Check the permission of the calling package if the device supports multi-pane. if (ActivityEmbeddingUtils.isEmbeddingActivityEnabled(activity)) { final String callingPackageName = ((SettingsActivity) activity).getInitialCallingPackage(); if (TextUtils.isEmpty(callingPackageName)) { Log.w(TAG, "Not able to get calling package name for permission check"); return false; } if (mPm.checkPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL, callingPackageName) != PackageManager.PERMISSION_GRANTED) { Log.w(TAG, "Package " + callingPackageName + " does not have required permission " + Manifest.permission.INTERACT_ACROSS_USERS_FULL); return false; } return true; } try { int callerUid = ActivityManager.getService().getLaunchedFromUid( activity.getActivityToken()); Loading src/com/android/settings/biometrics/face/FaceEnroll.kt +14 −10 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.util.Log import androidx.annotation.VisibleForTesting import androidx.appcompat.app.AppCompatActivity import com.android.settings.biometrics.BiometricEnrollBase.RESULT_FINISHED import com.android.settings.biometrics.MultiBiometricEnrollHelper.EXTRA_ENROLL_AFTER_FACE import com.android.settings.biometrics.combination.CombinedBiometricStatusUtils import com.android.settings.overlay.FeatureFactory.Companion.featureFactory Loading @@ -39,8 +40,7 @@ class FaceEnroll: AppCompatActivity() { private val enrollActivityProvider: FaceEnrollActivityClassProvider get() = featureFactory.faceFeatureProvider.enrollActivityClassProvider @VisibleForTesting var launchedFromProvider: () -> String? = { launchedFromPackage } @VisibleForTesting var launchedFromProvider: () -> String? = { launchedFromPackage } private var isLaunched = false Loading @@ -53,8 +53,8 @@ class FaceEnroll: AppCompatActivity() { if (!isLaunched) { /** * Logs the next activity to be launched, creates an intent for that activity, * adds flags to forward the result, includes any existing extras from the current intent, * Logs the next activity to be launched, creates an intent for that activity, adds * flags to forward the result, includes any existing extras from the current intent, * starts the new activity and then finishes the current one */ Log.d("FaceEnroll", "forward to $nextActivityClass") Loading @@ -63,6 +63,7 @@ class FaceEnroll: AppCompatActivity() { // drop extras that are not allowed from external packages before launching if (launchedFromProvider() != packageName) { nextIntent.removeExtra(EXTRA_ENROLL_AFTER_FACE) nextIntent.removeExtra(Intent.EXTRA_USER_ID) } startActivityForResult(nextIntent, 0) Loading @@ -80,13 +81,16 @@ class FaceEnroll: AppCompatActivity() { requestCode: Int, resultCode: Int, data: Intent?, caller: ComponentCaller caller: ComponentCaller, ) { super.onActivityResult(requestCode, resultCode, data, caller) isLaunched = false if (intent.getBooleanExtra( CombinedBiometricStatusUtils.EXTRA_LAUNCH_FROM_SAFETY_SOURCE_ISSUE, false) && resultCode != RESULT_FINISHED) { if ( intent.getBooleanExtra( CombinedBiometricStatusUtils.EXTRA_LAUNCH_FROM_SAFETY_SOURCE_ISSUE, false, ) && resultCode != RESULT_FINISHED ) { featureFactory.biometricsFeatureProvider.notifySafetyIssueActionLaunched() } setResult(resultCode, data) Loading src/com/android/settings/biometrics/face/FaceSettingsAppsPreferenceController.java +15 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.settings.biometrics.face; import static android.provider.Settings.Secure.BIOMETRIC_APP_ENABLED; import static android.provider.Settings.Secure.FACE_APP_ENABLED; import android.app.settings.SettingsEnums; Loading @@ -31,6 +32,7 @@ import com.android.settings.biometrics.activeunlock.ActiveUnlockStatusUtils; public class FaceSettingsAppsPreferenceController extends FaceSettingsPreferenceController { private static final int NOT_SET = -1; private static final int ON = 1; private static final int OFF = 0; private static final int DEFAULT = ON; Loading @@ -40,12 +42,23 @@ public class FaceSettingsAppsPreferenceController extends public FaceSettingsAppsPreferenceController(@NonNull Context context, @NonNull String key) { super(context, key); mFaceManager = Utils.getFaceManagerOrNull(context); // For OTA case: if FACE_APP_ENABLED is not set and BIOMETRIC_APP_ENABLED is set, set the // default value of the former to that of the latter. final int defValue = Settings.Secure.getIntForUser(mContext.getContentResolver(), FACE_APP_ENABLED, NOT_SET, getUserId()); final int oldDefValue = Settings.Secure.getIntForUser(mContext.getContentResolver(), BIOMETRIC_APP_ENABLED, NOT_SET, getUserId()); if (defValue == NOT_SET && oldDefValue != NOT_SET) { Settings.Secure.putIntForUser(mContext.getContentResolver(), FACE_APP_ENABLED, oldDefValue, getUserId()); } } @Override public boolean isChecked() { return Settings.Secure.getIntForUser(mContext.getContentResolver(), FACE_APP_ENABLED, DEFAULT, getUserId()) == ON; return Settings.Secure.getIntForUser(mContext.getContentResolver(), FACE_APP_ENABLED, DEFAULT, getUserId()) == ON; } @Override Loading src/com/android/settings/biometrics/face/FaceSettingsKeyguardUnlockPreferenceController.java +13 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.settings.biometrics.face; import static android.provider.Settings.Secure.BIOMETRIC_KEYGUARD_ENABLED; import static android.provider.Settings.Secure.FACE_KEYGUARD_ENABLED; import android.app.settings.SettingsEnums; Loading @@ -31,6 +32,7 @@ import com.android.settings.biometrics.activeunlock.ActiveUnlockStatusUtils; public class FaceSettingsKeyguardUnlockPreferenceController extends FaceSettingsPreferenceController { private static final int NOT_SET = -1; private static final int ON = 1; private static final int OFF = 0; private static final int DEFAULT = ON; Loading @@ -41,6 +43,17 @@ public class FaceSettingsKeyguardUnlockPreferenceController extends @NonNull Context context, @NonNull String key) { super(context, key); mFaceManager = Utils.getFaceManagerOrNull(context); // For OTA case: if FACE_KEYGUARD_ENABLED is not set and BIOMETRIC_KEYGUARD_ENABLED is set, // set the default value of the former to that of the latter. final int defValue = Settings.Secure.getIntForUser(mContext.getContentResolver(), FACE_KEYGUARD_ENABLED, NOT_SET, getUserId()); final int oldDefValue = Settings.Secure.getIntForUser(mContext.getContentResolver(), BIOMETRIC_KEYGUARD_ENABLED, NOT_SET, getUserId()); if (defValue == NOT_SET && oldDefValue != NOT_SET) { Settings.Secure.putIntForUser(mContext.getContentResolver(), FACE_KEYGUARD_ENABLED, oldDefValue, getUserId()); } } @Override Loading Loading
AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -2500,7 +2500,7 @@ android:name="Settings$AppUsageAccessSettingsActivity" android:exported="true" android:label="@string/usage_access_title"> <intent-filter> <intent-filter android:priority="1"> <action android:name="android.settings.USAGE_ACCESS_SETTINGS"/> <category android:name="android.intent.category.DEFAULT"/> <data android:scheme="package"/> Loading
src/com/android/settings/applications/AppInfoBase.java +20 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ import androidx.fragment.app.Fragment; import com.android.settings.SettingsActivity; import com.android.settings.SettingsPreferenceFragment; import com.android.settings.activityembedding.ActivityEmbeddingUtils; import com.android.settings.applications.manageapplications.ManageApplications; import com.android.settings.core.SubSettingLauncher; import com.android.settings.core.instrumentation.InstrumentedDialogFragment; Loading Loading @@ -178,6 +179,25 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment if (!(activity instanceof SettingsActivity)) { return false; } // Check the permission of the calling package if the device supports multi-pane. if (ActivityEmbeddingUtils.isEmbeddingActivityEnabled(activity)) { final String callingPackageName = ((SettingsActivity) activity).getInitialCallingPackage(); if (TextUtils.isEmpty(callingPackageName)) { Log.w(TAG, "Not able to get calling package name for permission check"); return false; } if (mPm.checkPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL, callingPackageName) != PackageManager.PERMISSION_GRANTED) { Log.w(TAG, "Package " + callingPackageName + " does not have required permission " + Manifest.permission.INTERACT_ACROSS_USERS_FULL); return false; } return true; } try { int callerUid = ActivityManager.getService().getLaunchedFromUid( activity.getActivityToken()); Loading
src/com/android/settings/biometrics/face/FaceEnroll.kt +14 −10 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.util.Log import androidx.annotation.VisibleForTesting import androidx.appcompat.app.AppCompatActivity import com.android.settings.biometrics.BiometricEnrollBase.RESULT_FINISHED import com.android.settings.biometrics.MultiBiometricEnrollHelper.EXTRA_ENROLL_AFTER_FACE import com.android.settings.biometrics.combination.CombinedBiometricStatusUtils import com.android.settings.overlay.FeatureFactory.Companion.featureFactory Loading @@ -39,8 +40,7 @@ class FaceEnroll: AppCompatActivity() { private val enrollActivityProvider: FaceEnrollActivityClassProvider get() = featureFactory.faceFeatureProvider.enrollActivityClassProvider @VisibleForTesting var launchedFromProvider: () -> String? = { launchedFromPackage } @VisibleForTesting var launchedFromProvider: () -> String? = { launchedFromPackage } private var isLaunched = false Loading @@ -53,8 +53,8 @@ class FaceEnroll: AppCompatActivity() { if (!isLaunched) { /** * Logs the next activity to be launched, creates an intent for that activity, * adds flags to forward the result, includes any existing extras from the current intent, * Logs the next activity to be launched, creates an intent for that activity, adds * flags to forward the result, includes any existing extras from the current intent, * starts the new activity and then finishes the current one */ Log.d("FaceEnroll", "forward to $nextActivityClass") Loading @@ -63,6 +63,7 @@ class FaceEnroll: AppCompatActivity() { // drop extras that are not allowed from external packages before launching if (launchedFromProvider() != packageName) { nextIntent.removeExtra(EXTRA_ENROLL_AFTER_FACE) nextIntent.removeExtra(Intent.EXTRA_USER_ID) } startActivityForResult(nextIntent, 0) Loading @@ -80,13 +81,16 @@ class FaceEnroll: AppCompatActivity() { requestCode: Int, resultCode: Int, data: Intent?, caller: ComponentCaller caller: ComponentCaller, ) { super.onActivityResult(requestCode, resultCode, data, caller) isLaunched = false if (intent.getBooleanExtra( CombinedBiometricStatusUtils.EXTRA_LAUNCH_FROM_SAFETY_SOURCE_ISSUE, false) && resultCode != RESULT_FINISHED) { if ( intent.getBooleanExtra( CombinedBiometricStatusUtils.EXTRA_LAUNCH_FROM_SAFETY_SOURCE_ISSUE, false, ) && resultCode != RESULT_FINISHED ) { featureFactory.biometricsFeatureProvider.notifySafetyIssueActionLaunched() } setResult(resultCode, data) Loading
src/com/android/settings/biometrics/face/FaceSettingsAppsPreferenceController.java +15 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.settings.biometrics.face; import static android.provider.Settings.Secure.BIOMETRIC_APP_ENABLED; import static android.provider.Settings.Secure.FACE_APP_ENABLED; import android.app.settings.SettingsEnums; Loading @@ -31,6 +32,7 @@ import com.android.settings.biometrics.activeunlock.ActiveUnlockStatusUtils; public class FaceSettingsAppsPreferenceController extends FaceSettingsPreferenceController { private static final int NOT_SET = -1; private static final int ON = 1; private static final int OFF = 0; private static final int DEFAULT = ON; Loading @@ -40,12 +42,23 @@ public class FaceSettingsAppsPreferenceController extends public FaceSettingsAppsPreferenceController(@NonNull Context context, @NonNull String key) { super(context, key); mFaceManager = Utils.getFaceManagerOrNull(context); // For OTA case: if FACE_APP_ENABLED is not set and BIOMETRIC_APP_ENABLED is set, set the // default value of the former to that of the latter. final int defValue = Settings.Secure.getIntForUser(mContext.getContentResolver(), FACE_APP_ENABLED, NOT_SET, getUserId()); final int oldDefValue = Settings.Secure.getIntForUser(mContext.getContentResolver(), BIOMETRIC_APP_ENABLED, NOT_SET, getUserId()); if (defValue == NOT_SET && oldDefValue != NOT_SET) { Settings.Secure.putIntForUser(mContext.getContentResolver(), FACE_APP_ENABLED, oldDefValue, getUserId()); } } @Override public boolean isChecked() { return Settings.Secure.getIntForUser(mContext.getContentResolver(), FACE_APP_ENABLED, DEFAULT, getUserId()) == ON; return Settings.Secure.getIntForUser(mContext.getContentResolver(), FACE_APP_ENABLED, DEFAULT, getUserId()) == ON; } @Override Loading
src/com/android/settings/biometrics/face/FaceSettingsKeyguardUnlockPreferenceController.java +13 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.settings.biometrics.face; import static android.provider.Settings.Secure.BIOMETRIC_KEYGUARD_ENABLED; import static android.provider.Settings.Secure.FACE_KEYGUARD_ENABLED; import android.app.settings.SettingsEnums; Loading @@ -31,6 +32,7 @@ import com.android.settings.biometrics.activeunlock.ActiveUnlockStatusUtils; public class FaceSettingsKeyguardUnlockPreferenceController extends FaceSettingsPreferenceController { private static final int NOT_SET = -1; private static final int ON = 1; private static final int OFF = 0; private static final int DEFAULT = ON; Loading @@ -41,6 +43,17 @@ public class FaceSettingsKeyguardUnlockPreferenceController extends @NonNull Context context, @NonNull String key) { super(context, key); mFaceManager = Utils.getFaceManagerOrNull(context); // For OTA case: if FACE_KEYGUARD_ENABLED is not set and BIOMETRIC_KEYGUARD_ENABLED is set, // set the default value of the former to that of the latter. final int defValue = Settings.Secure.getIntForUser(mContext.getContentResolver(), FACE_KEYGUARD_ENABLED, NOT_SET, getUserId()); final int oldDefValue = Settings.Secure.getIntForUser(mContext.getContentResolver(), BIOMETRIC_KEYGUARD_ENABLED, NOT_SET, getUserId()); if (defValue == NOT_SET && oldDefValue != NOT_SET) { Settings.Secure.putIntForUser(mContext.getContentResolver(), FACE_KEYGUARD_ENABLED, oldDefValue, getUserId()); } } @Override Loading