Snap for 11406759 from 9531458ca5
to 24Q2-release
Change-Id: I8001d0c2ef2f40dac7223526dae71cf55b57ee38
This commit is contained in:
@@ -3232,7 +3232,8 @@
|
||||
|
||||
<receiver
|
||||
android:name=".fuelgauge.batteryusage.BootBroadcastReceiver"
|
||||
android:exported="true">
|
||||
android:exported="true"
|
||||
android:permission="com.android.settings.BATTERY_DATA">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
||||
<action android:name="com.google.android.setupwizard.SETUP_WIZARD_FINISHED"/>
|
||||
|
1
OWNERS
1
OWNERS
@@ -11,7 +11,6 @@ edgarwang@google.com
|
||||
jiannan@google.com
|
||||
millchen@google.com
|
||||
sunnyshao@google.com
|
||||
yantingyang@google.com
|
||||
|
||||
# Android Settings extended
|
||||
chaohuiw@google.com
|
||||
|
@@ -13,3 +13,10 @@ flag {
|
||||
description: "Enabling will provide an explicit package name for Intent to update mainline modules"
|
||||
bug: "278987474"
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "app_archiving"
|
||||
namespace: "android_settings"
|
||||
description: "Feature flag to enable the archiving feature."
|
||||
bug: "323164382"
|
||||
}
|
||||
|
@@ -1219,15 +1219,15 @@
|
||||
<string name="work_profile_category_header">Work profile</string>
|
||||
|
||||
<!-- Title for the Private Space page. [CHAR LIMIT=60] -->
|
||||
<string name="private_space_title">Private Space</string>
|
||||
<string name="private_space_title">Private space</string>
|
||||
<!-- Summary for the Private Space page. [CHAR LIMIT=NONE] -->
|
||||
<string name="private_space_summary">Keep private apps locked and hidden</string>
|
||||
<!-- Description for the Private Space page. [CHAR LIMIT=NONE] -->
|
||||
<string name="private_space_description">Keep private apps in a separate space that you can hide or lock</string>
|
||||
<!-- Title for the Private Space one lock preference. [CHAR LIMIT=60] -->
|
||||
<string name="private_space_lock_title">Private Space lock</string>
|
||||
<string name="private_space_lock_title">Private space lock</string>
|
||||
<!-- Description for the Private Space one lock preference page. [CHAR LIMIT=NONE] -->
|
||||
<string name="private_space_one_lock_summary">You can unlock Private Space the same way you unlock your device, or choose a different lock</string>
|
||||
<string name="private_space_one_lock_summary">You can unlock your private space the same way you unlock your device, or choose a different lock</string>
|
||||
<!-- Title for the Private Space one lock preference. [CHAR LIMIT=60] -->
|
||||
<string name="private_space_screen_lock_title">Use device screen lock</string>
|
||||
<!-- Title for the Face and Fingerprint preference. [CHAR LIMIT=60] -->
|
||||
@@ -1239,15 +1239,15 @@
|
||||
<!-- Summary for the Face and Fingerprint preference when no biometric is set. [CHAR LIMIT=60] -->
|
||||
<string name="private_space_biometric_summary">Tap to set up</string>
|
||||
<!-- Title for the Fingerprint unlock for private space preference. [CHAR LIMIT=60] -->
|
||||
<string name="private_space_fingerprint_unlock_title">Fingerprint Unlock for Private Space</string>
|
||||
<string name="private_space_fingerprint_unlock_title">Fingerprint Unlock for private space</string>
|
||||
<!-- Title for the Face unlock for private space preference. [CHAR LIMIT=60] -->
|
||||
<string name="private_space_face_unlock_title">Face Unlock for Private Space</string>
|
||||
<string name="private_space_face_unlock_title">Face Unlock for private space</string>
|
||||
<!-- Biometric category title - biometric options for unlocking the device. [CHAR LIMIT=50] -->
|
||||
<string name="private_space_category_ways_to_unlock">Ways to unlock</string>
|
||||
<!-- Summary for one lock when device screen lock is used as private profile lock. [CHAR LIMIT=40] -->
|
||||
<string name="private_space_screen_lock_summary">Same as device screen lock</string>
|
||||
<!-- Dialog message to choose a new lock for Private Space. [CHAR LIMIT=50] -->
|
||||
<string name="private_space_new_lock_title">Choose a new lock for Private Space?</string>
|
||||
<string name="private_space_new_lock_title">Choose a new lock for private space?</string>
|
||||
<!-- Title for the preference for auto lock private space. [CHAR LIMIT=40] -->
|
||||
<string name="private_space_auto_lock_title">Lock automatically</string>
|
||||
<!-- Title for private space auto lock settings page. [CHAR LIMIT=50] -->
|
||||
@@ -1263,17 +1263,17 @@
|
||||
<!-- Title for the preference to hide Private Space. [CHAR LIMIT=60] -->
|
||||
<string name="private_space_hide_title">Hide when locked</string>
|
||||
<!-- Title for the hide Private Space setting. [CHAR LIMIT=60] -->
|
||||
<string name="privatespace_hide_page_title">Hide Private Space when locked</string>
|
||||
<string name="privatespace_hide_page_title">Hide private space when locked</string>
|
||||
<!-- Description for hide Private Space settings page. [CHAR LIMIT=NONE] -->
|
||||
<string name="privatespace_hide_page_summary">To stop other people knowing Private Space is on your device, you can hide it from your apps list</string>
|
||||
<string name="privatespace_hide_page_summary">To stop other people knowing you have a private space on your device, you can hide it from your apps list</string>
|
||||
<!-- Header in hide Private Space settings page to access Private Space when hidden. [CHAR LIMIT=60] -->
|
||||
<string name="privatespace_access_header">Access Private Space when hidden</string>
|
||||
<string name="privatespace_access_header">Access private space when hidden</string>
|
||||
<!-- Text in hide Private Space settings page on how to search Private Space when hidden. [CHAR LIMIT=60] -->
|
||||
<string name="privatespace_search_description">Search for \'Private Space\' in the search bar</string>
|
||||
<string name="privatespace_search_description">From your apps list, enter \'private space\' in the search bar</string>
|
||||
<!-- Text in hide Private Space settings page to tap on Private Space tile. [CHAR LIMIT=60] -->
|
||||
<string name="privatespace_tap_tile_description">Tap the Private Space tile</string>
|
||||
<string name="privatespace_tap_tile_description">Tap the private space tile</string>
|
||||
<!-- Text in hide Private Space settings page to Unlock Private Space. [CHAR LIMIT=60] -->
|
||||
<string name="privatespace_unlock_description">Unlock your Private Space</string>
|
||||
<string name="privatespace_unlock_description">Unlock your private space</string>
|
||||
<!-- Used to describe the off state of Private space hidden [CHAR LIMIT=30] -->
|
||||
<string name="privatespace_hide_off_summary">Off</string>
|
||||
<!-- Used to describe the off state of Private space hidden [CHAR LIMIT=30] -->
|
||||
@@ -1295,9 +1295,9 @@
|
||||
<!-- Description for private space delete confirmation page that mentions it will take a few moments. [CHAR LIMIT=40] -->
|
||||
<string name="private_space_confirm_deletion_summary">This will take a few moments</string>
|
||||
<!-- Toast to show when the private space was deleted. [CHAR LIMIT=NONE] -->
|
||||
<string name="private_space_deleted">Private Space successfully deleted</string>
|
||||
<string name="private_space_deleted">Private space deleted</string>
|
||||
<!-- Toast to show when the private space could not be deleted. [CHAR LIMIT=NONE] -->
|
||||
<string name="private_space_delete_failed">Private Space could not be deleted</string>
|
||||
<string name="private_space_delete_failed">Private space could not be deleted</string>
|
||||
<!-- Toast to show when the private space is unlocked from settings entry point. [CHAR LIMIT=40] -->
|
||||
<string name="private_space_unlocked">Private space unlocked</string>
|
||||
<!-- Title of the Alert Dialog when no screen lock is set [CHAR LIMIT=30] -->
|
||||
@@ -1329,13 +1329,13 @@
|
||||
<!-- Text shown at the bottom in private space auto advancing screens. [CHAR LIMIT=60] -->
|
||||
<string name="private_space_setting_up_text">Setting up private space\u2026</string>
|
||||
<!-- Title for private space setup in auto advancing screen informing private space notifications are hidden when locked. [CHAR LIMIT=NONE] -->
|
||||
<string name="private_space_notifications_hidden_title">Notifications from apps in private space are hidden when it\u2019s locked</string>
|
||||
<string name="private_space_notifications_hidden_title">Notifications from private space apps are hidden when it\u2019s locked</string>
|
||||
<!-- Title for private space setup in auto advancing screen informing photos/files from private space can be shared when unlocked. [CHAR LIMIT=NONE] -->
|
||||
<string name="private_space_share_photos_title">Unlock private space to share photos or files from private space apps</string>
|
||||
<string name="private_space_share_photos_title">Unlock private space to share photos or files</string>
|
||||
<!-- Title for private space setup in auto advancing screen informing some system apps are already installed in private space. [CHAR LIMIT=NONE] -->
|
||||
<string name="private_space_apps_installed_title">Some apps are already installed in your private space</string>
|
||||
<!-- Title for private space creation error screen. [CHAR LIMIT=60] -->
|
||||
<string name="private_space_error_screen_title">Couldn\u2019t set up private space</string>
|
||||
<string name="private_space_error_screen_title">Couldn\u2019t set up a private space</string>
|
||||
<!-- Label for button to retry creating private space again on creation error. [CHAR LIMIT=30] -->
|
||||
<string name="private_space_tryagain_label">Try Again</string>
|
||||
<!-- Title for private space lock setup screen. [CHAR LIMIT=90] -->
|
||||
@@ -1349,7 +1349,7 @@
|
||||
<!-- Title for private space setup success screen. [CHAR LIMIT=30] -->
|
||||
<string name="private_space_success_title">All set!</string>
|
||||
<!-- Summary for the private space setup success screen. [CHAR LIMIT=NONE] -->
|
||||
<string name="private_space_access_text">To access your private space, go to your apps list then scroll down</string>
|
||||
<string name="private_space_access_text">To find your private space, go to your apps list then scroll down</string>
|
||||
<!-- Label for private space done button to show a toast, finish setup and launch All apps [CHAR LIMIT=30] -->
|
||||
<string name="private_space_done_label">Done</string>
|
||||
<!-- Toast to show on private space setup completion informing user to scroll down All apps to access private space. [CHAR LIMIT=60] -->
|
||||
@@ -1375,13 +1375,13 @@
|
||||
|
||||
<!-- TODO(b/309950257): Remove below strings once QSTIle fulfillment is complete. -->
|
||||
<!-- Header in hide Private Space settings page to unhide Private Space. [CHAR LIMIT=90] -->
|
||||
<string name="privatespace_unhide_header">To show Private Space (Not final UX)</string>
|
||||
<string name="privatespace_unhide_header">To show private space (Not final UX)</string>
|
||||
<!-- Text in hide Private Space settings page on how to open Private Space setting. [CHAR LIMIT=NONE] -->
|
||||
<string name="privatespace_open_settings">Open the Settings App</string>
|
||||
<!-- Text in hide Private Space settings page on how to open Private Space setting. [CHAR LIMIT=NONE] -->
|
||||
<string name="privatespace_tap_settings">Tap on Security & privacy > Private Space > Hide Private Space when locked</string>
|
||||
<string name="privatespace_tap_settings">Tap on Security & privacy > private space > Hide private space when locked</string>
|
||||
<!-- Text in hide Private Space settings page to off hide toggle. [CHAR LIMIT=90] -->
|
||||
<string name="privatespace_turnoff_hide">Turn off \‘Hide Private Space when locked\’ toggle</string>
|
||||
<string name="privatespace_turnoff_hide">Turn off \‘Hide private space when locked\’ toggle</string>
|
||||
<!-- Note in hide Private Space settings page to inform that this is a development feature. [CHAR LIMIT=NONE] -->
|
||||
<string name="privatespace_development_note">Note to Googlers: The development of this feature is still in progress</string>
|
||||
|
||||
@@ -7265,7 +7265,7 @@
|
||||
<!-- Summary text describing signal strength to the user. [CHAR LIMIT=60] -->
|
||||
<string name="sim_signal_strength"><xliff:g id="dbm">%1$d</xliff:g> dBm <xliff:g id="asu">%2$d</xliff:g> asu</string>
|
||||
<!-- Title for SIM notification. [CHAR LIMIT=40] -->
|
||||
<string name="sim_notification_title">SIMs changed.</string>
|
||||
<string name="sim_notification_title">Your SIMs changed</string>
|
||||
<!-- Message under title informing the user to touch to go to SIM Cards in Settings. [CHAR LIMIT=40] -->
|
||||
<string name="sim_notification_summary">Tap to set up</string>
|
||||
|
||||
@@ -9055,7 +9055,7 @@
|
||||
<string name="screen_pinning_unlock_none">Lock device when unpinning</string>
|
||||
|
||||
<!-- [CHAR LIMIT=60] turn eSim deletion confirmation on/off -->
|
||||
<string name="confirm_sim_deletion_title">Confirm SIM deletion</string>
|
||||
<string name="confirm_sim_deletion_title">Confirm you want to erase your eSIM</string>
|
||||
<!-- [CHAR LIMIT=NONE] eSim deletion confirmation description -->
|
||||
<string name="confirm_sim_deletion_description">Verify it\u0027s you before erasing an eSIM</string>
|
||||
|
||||
@@ -11370,7 +11370,7 @@
|
||||
the user that the way to disable this SIM is to physically remove it. This is in contrast
|
||||
to eSIM's, which can disabled using an on/off toggle switch. [CHAR LIMIT=NONE] -->
|
||||
<string name="mobile_network_disable_sim_explanation">
|
||||
To disable this SIM, remove the SIM card
|
||||
To turn off this SIM, remove the SIM card
|
||||
</string>
|
||||
|
||||
<!--Summary used when a physical SIM is disabled, indicating that tapping on the preference will
|
||||
@@ -11378,7 +11378,7 @@
|
||||
Network & internet page (if there are no other SIMs), or on the mobile network list page.
|
||||
[CHAR LIMIT=50] -->
|
||||
<string name="mobile_network_tap_to_activate">
|
||||
Tap to activate <xliff:g id="carrier" example="T-mobile">%1$s</xliff:g>
|
||||
Tap to activate your <xliff:g id="carrier" example="T-mobile">%1$s</xliff:g> SIM
|
||||
</string>
|
||||
|
||||
<!-- Mobile network details page. Label for an option that lets the user delete an eSIM from
|
||||
@@ -11502,13 +11502,13 @@
|
||||
<!-- Text of carrier list item in the mep confirmation dialog asking the user if they want to turn off the carrier. [CHAR_LIMIT=NONE] -->
|
||||
<string name="sim_action_switch_sub_dialog_info_outline_for_turning_off">Turning off a SIM won\u2019t cancel your service</string>
|
||||
<!-- Status message indicating the device is in the process of disconnecting from one mobile network and immediately connecting to another. [CHAR_LIMIT=NONE] -->
|
||||
<string name="sim_action_enabling_sim_without_carrier_name">Connecting to network…</string>
|
||||
<string name="sim_action_enabling_sim_without_carrier_name">Activating your SIM…</string>
|
||||
<!-- Text of progress dialog indicating the subscription switch is in progress. [CHAR_LIMIT=NONE] -->
|
||||
<string name="sim_action_switch_sub_dialog_progress">Switching to <xliff:g id="carrier_name" example="Google Fi">%1$s</xliff:g> for calls and messages…</string>
|
||||
<string name="sim_action_switch_sub_dialog_progress">Switching to <xliff:g id="carrier_name" example="Google Fi">%1$s</xliff:g>…</string>
|
||||
<!-- Title of error message indicating that the device could not disconnect from one mobile network and immediately connect to another. [CHAR_LIMIT=NONE] -->
|
||||
<string name="sim_action_enable_sim_fail_title">Can\u2019t switch carrier</string>
|
||||
<string name="sim_action_enable_sim_fail_title">Can\u2019t switch SIMs</string>
|
||||
<!-- Body text of error message indicating the device could not disconnect from one mobile network and immediately connect to another, due to an unspecified issue. [CHAR_LIMIT=NONE] -->
|
||||
<string name="sim_action_enable_sim_fail_text">The carrier can\u2019t be switched due to an error.</string>
|
||||
<string name="sim_action_enable_sim_fail_text">Something went wrong. Can\u2019t switch SIMs.</string>
|
||||
<!-- Title of confirmation dialog asking the user if they want to disable subscription. [CHAR_LIMIT=NONE] -->
|
||||
<string name="privileged_action_disable_sub_dialog_title">Turn off <xliff:g id="carrier_name" example="Google Fi">%1$s</xliff:g>?</string>
|
||||
<!-- Title of confirmation dialog asking the user if they want to disable subscription. [CHAR_LIMIT=NONE] -->
|
||||
@@ -11516,9 +11516,9 @@
|
||||
<!-- Disabling SIMs progress dialog message [CHAR LIMIT=NONE] -->
|
||||
<string name="privileged_action_disable_sub_dialog_progress">Turning off SIM<xliff:g id="ellipsis" example="...">…</xliff:g></string>
|
||||
<!-- Title of error messaging indicating the device could not disable the mobile network. [CHAR LIMIT=NONE] -->
|
||||
<string name="privileged_action_disable_fail_title">Can\u2019t disable carrier</string>
|
||||
<string name="privileged_action_disable_fail_title">Can\u2019t turn off SIM</string>
|
||||
<!-- Body text of error message indicating the device could not disable the mobile network, due to an unknown issue. [CHAR LIMIT=NONE] -->
|
||||
<string name="privileged_action_disable_fail_text">Something went wrong and your carrier could not be disabled.</string>
|
||||
<string name="privileged_action_disable_fail_text">Something went wrong and your SIM could not be turned off.</string>
|
||||
<!-- Title on a dialog asking the users whether they want to enable DSDS mode. [CHAR LIMIT=NONE] -->
|
||||
<string name="sim_action_enable_dsds_title">Use 2 SIMs?</string>
|
||||
<!-- Message in a dialog indicating the user can enable DSDS mode. [CHAR LIMIT=NONE] -->
|
||||
@@ -11598,7 +11598,7 @@
|
||||
<!-- Title on a push notification indicating that the user's device is in the middle of switching between mobile networks. [CHAR LIMIT=NONE] -->
|
||||
<string name="sim_switch_channel_id">Carrier switching</string>
|
||||
<!-- The title of post DSDS reboot notification. The title includes carrier's name. [CHAR LIMIT=NONE] -->
|
||||
<string name="post_dsds_reboot_notification_title_with_carrier"><xliff:g id="carrier_name" example="Google Fi">%1$s</xliff:g> is active</string>
|
||||
<string name="post_dsds_reboot_notification_title_with_carrier">Your <xliff:g id="carrier_name" example="Google Fi">%1$s</xliff:g> SIM is active</string>
|
||||
<!-- The body text of post DSDS reboot notification. [CHAR LIMIT=NONE] -->
|
||||
<string name="post_dsds_reboot_notification_text">Tap to update SIM settings</string>
|
||||
<!-- Title on a push notification indicating that the user's device switched to a new mobile network. [CHAR LIMIT=NONE] -->
|
||||
@@ -11614,17 +11614,17 @@
|
||||
|
||||
<!-- Strings for choose SIM activity -->
|
||||
<!-- The title text of choose SIM activity. [CHAR LIMIT=NONE] -->
|
||||
<string name="choose_sim_title">Choose a number to use</string>
|
||||
<string name="choose_sim_title">Choose a SIM to use</string>
|
||||
<!-- The body text of choose SIM activity. [CHAR LIMIT=NONE] -->
|
||||
<string name="choose_sim_text">{count, plural,
|
||||
=1 {1 number is available on this device, but only one can be used at a time}
|
||||
=2 {2 numbers are available on this device, but only one can be used at a time}
|
||||
other {# numbers are available on this device, but only one can be used at a time}
|
||||
=1 {1 SIM is available on this device, but only one can be used at a time}
|
||||
=2 {2 SIMs are available on this device, but only one can be used at a time}
|
||||
other {# SIMs are available on this device, but only one can be used at a time}
|
||||
}</string>
|
||||
<!-- String indicating that we are activating the profile [CHAR LIMIT=NONE] -->
|
||||
<string name="choose_sim_activating">Activating<xliff:g id="ellipsis" example="...">…</xliff:g></string>
|
||||
<!-- String indicating that we failed to activate the selected profile [CHAR LIMIT=NONE] -->
|
||||
<string name="choose_sim_could_not_activate">Couldn\u2019t be activated right now</string>
|
||||
<string name="choose_sim_could_not_activate">Couldn\u2019t activate this SIM right now</string>
|
||||
|
||||
<!-- Strings for switch SIM confirmation dialog. -->
|
||||
<!-- The title text of switch SIM confirmation dialog. [CHAR LIMIT=NONE] -->
|
||||
@@ -11979,6 +11979,11 @@
|
||||
<!-- Developer settings: Summary for allowing mock modem service. [CHAR LIMIT=NONE]-->
|
||||
<string name="allow_mock_modem_summary">Allow this device to run Mock Modem service for instrumentation testing. Do not enable this during normal usage of the phone</string>
|
||||
|
||||
<!-- Developer settings: Title for disable app and notification screen share protections [CHAR LIMIT=50] -->
|
||||
<string name="disable_screen_share_protections_for_apps_and_notifications">Disable screen share protections</string>
|
||||
<!-- Developer settings: Summary for disable app and notification screen share protections summary [CHAR LIMIT=150] -->
|
||||
<string name="disable_screen_share_protections_for_apps_and_notifications_summary">Disables system applied app and notifications protections during screen sharing</string>
|
||||
|
||||
<!-- Title for media control settings [CHAR LIMIT=50]-->
|
||||
<string name="media_controls_title">Media</string>
|
||||
<!-- Title of toggle to enable or disable the media resumption feature in quick settings [CHAR LIMIT=50]-->
|
||||
|
@@ -705,6 +705,11 @@
|
||||
android:title="@string/show_notification_channel_warnings"
|
||||
android:summary="@string/show_notification_channel_warnings_summary" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:key="disable_screen_share_protections_for_apps_and_notifications"
|
||||
android:title="@string/disable_screen_share_protections_for_apps_and_notifications"
|
||||
android:summary="@string/disable_screen_share_protections_for_apps_and_notifications_summary" />
|
||||
|
||||
<Preference
|
||||
android:key="asst_importance_reset"
|
||||
android:title="@string/asst_importance_reset_title"
|
||||
|
@@ -22,12 +22,15 @@ import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.ApplicationInfoFlags;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.settings.flags.Flags;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AppCounter extends AsyncTask<Void, Void, Integer> {
|
||||
@@ -54,7 +57,7 @@ public abstract class AppCounter extends AsyncTask<Void, Void, Integer> {
|
||||
for (UserInfo user : mUm.getProfiles(UserHandle.myUserId())) {
|
||||
long flags = PackageManager.GET_DISABLED_COMPONENTS
|
||||
| PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS
|
||||
| (mFf.archiving() ? PackageManager.MATCH_ARCHIVED_PACKAGES : 0)
|
||||
| (isArchivingEnabled() ? PackageManager.MATCH_ARCHIVED_PACKAGES : 0)
|
||||
| (user.isAdmin() ? PackageManager.MATCH_ANY_USER : 0);
|
||||
ApplicationInfoFlags infoFlags = ApplicationInfoFlags.of(flags);
|
||||
final List<ApplicationInfo> list =
|
||||
@@ -68,6 +71,11 @@ public abstract class AppCounter extends AsyncTask<Void, Void, Integer> {
|
||||
return count;
|
||||
}
|
||||
|
||||
private boolean isArchivingEnabled() {
|
||||
return mFf.archiving() || SystemProperties.getBoolean("pm.archiving.enabled", false)
|
||||
|| Flags.appArchiving();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Integer count) {
|
||||
onCountComplete(count);
|
||||
|
@@ -763,6 +763,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|
||||
context, context.getSystemService(UiModeManager.class)));
|
||||
controllers.add(new ForceEnableNotesRolePreferenceController(context));
|
||||
controllers.add(new GrammaticalGenderPreferenceController(context));
|
||||
controllers.add(new SensitiveContentProtectionPreferenceController(context));
|
||||
|
||||
return controllers;
|
||||
}
|
||||
|
@@ -1,6 +1,9 @@
|
||||
# GameDefaultFrameRatePreferenceController
|
||||
per-file GameDefaultFrameRatePreferenceController.java=file:platform/frameworks/base:/GAME_MANAGER_OWNERS
|
||||
|
||||
# SensitiveContentProtectionPreferenceController
|
||||
per-file SensitiveContentProtectionPreferenceController.kt=file:platform/frameworks/base:/core/java/android/permission/OWNERS
|
||||
|
||||
# ShowHdrSdrRatioPreferenceController
|
||||
per-file ShowHdrSdrRatioPreferenceController.java=file:platform/frameworks/native:/services/surfaceflinger/OWNERS
|
||||
|
||||
|
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.settings.development
|
||||
|
||||
import android.content.Context
|
||||
import android.provider.Settings
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.TwoStatePreference
|
||||
import com.android.server.notification.Flags.sensitiveNotificationAppProtection
|
||||
import com.android.server.notification.Flags.screenshareNotificationHiding
|
||||
import com.android.settings.core.PreferenceControllerMixin
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController
|
||||
|
||||
class SensitiveContentProtectionPreferenceController(val context: Context) :
|
||||
DeveloperOptionsPreferenceController(context),
|
||||
Preference.OnPreferenceChangeListener,
|
||||
PreferenceControllerMixin {
|
||||
|
||||
override fun getPreferenceKey(): String =
|
||||
DISABLE_SCREEN_SHARE_PROTECTIONS_FOR_APPS_AND_NOTIFICATIONS_KEY
|
||||
|
||||
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
|
||||
val isEnabled = newValue as Boolean
|
||||
Settings.Global.putInt(
|
||||
mContext.getContentResolver(),
|
||||
Settings.Global.DISABLE_SCREEN_SHARE_PROTECTIONS_FOR_APPS_AND_NOTIFICATIONS,
|
||||
if (isEnabled) SETTING_VALUE_ON else SETTING_VALUE_OFF
|
||||
)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun updateState(preference: Preference?) {
|
||||
val mode = Settings.Global.getInt(
|
||||
mContext.getContentResolver(),
|
||||
Settings.Global.DISABLE_SCREEN_SHARE_PROTECTIONS_FOR_APPS_AND_NOTIFICATIONS,
|
||||
0)
|
||||
(mPreference as TwoStatePreference).isChecked = mode != SETTING_VALUE_OFF
|
||||
}
|
||||
|
||||
// Overriding as public, kotlin tests can not invoke a protected method
|
||||
public override fun onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled()
|
||||
Settings.Global.putInt(
|
||||
mContext.getContentResolver(),
|
||||
Settings.Global.DISABLE_SCREEN_SHARE_PROTECTIONS_FOR_APPS_AND_NOTIFICATIONS,
|
||||
SETTING_VALUE_OFF
|
||||
)
|
||||
(mPreference as TwoStatePreference).isChecked = false
|
||||
}
|
||||
|
||||
override fun isAvailable(): Boolean {
|
||||
return sensitiveNotificationAppProtection() || screenshareNotificationHiding()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val DISABLE_SCREEN_SHARE_PROTECTIONS_FOR_APPS_AND_NOTIFICATIONS_KEY =
|
||||
"disable_screen_share_protections_for_apps_and_notifications"
|
||||
|
||||
@VisibleForTesting
|
||||
val SETTING_VALUE_ON = 1
|
||||
|
||||
@VisibleForTesting
|
||||
val SETTING_VALUE_OFF = 0
|
||||
}
|
||||
}
|
@@ -41,7 +41,7 @@ import com.android.settingslib.fuelgauge.BatterySaverUtils;
|
||||
public class BatterySaverScheduleRadioButtonsController {
|
||||
private static final String TAG = "BatterySaverScheduleRadioButtonsController";
|
||||
|
||||
public static final int TRIGGER_LEVEL_MIN = 10;
|
||||
public static final int TRIGGER_LEVEL_MIN = 20;
|
||||
|
||||
private Context mContext;
|
||||
private BatterySaverScheduleSeekBarController mSeekBarController;
|
||||
|
@@ -41,7 +41,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.internal.accessibility.common.ShortcutConstants;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.accessibility.AccessibilityGestureNavigationTutorial;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
@@ -354,7 +353,7 @@ public class SystemNavigationGestureSettings extends RadioButtonPickerFragment i
|
||||
private boolean isAnyServiceSupportAccessibilityButton() {
|
||||
final AccessibilityManager ams = getContext().getSystemService(AccessibilityManager.class);
|
||||
final List<String> targets = ams.getAccessibilityShortcutTargets(
|
||||
ShortcutConstants.UserShortcutType.SOFTWARE);
|
||||
AccessibilityManager.ACCESSIBILITY_BUTTON);
|
||||
return !targets.isEmpty();
|
||||
}
|
||||
|
||||
|
@@ -16,6 +16,7 @@ package com.android.settings.nfc;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.permission.flags.Flags;
|
||||
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
@@ -68,6 +69,9 @@ public class NfcForegroundPreferenceController extends BasePreferenceController
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
if (Flags.walletRoleEnabled()) {
|
||||
return UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
final PackageManager pm = mContext.getPackageManager();
|
||||
if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC)) {
|
||||
return UNSUPPORTED_ON_DEVICE;
|
||||
|
@@ -62,7 +62,7 @@ public class PoliteNotifWorkProfileToggleController extends TogglePreferenceCont
|
||||
@Override
|
||||
public boolean isChecked() {
|
||||
return Settings.System.getIntForUser(mContext.getContentResolver(),
|
||||
Settings.System.NOTIFICATION_COOLDOWN_ENABLED, OFF, mManagedProfileId) != OFF;
|
||||
Settings.System.NOTIFICATION_COOLDOWN_ENABLED, ON, mManagedProfileId) != OFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -17,8 +17,8 @@
|
||||
package com.android.settings.spa.app.appinfo
|
||||
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.pm.FeatureFlags
|
||||
import android.content.pm.FeatureFlagsImpl
|
||||
import android.content.pm.FeatureFlags as PmFeatureFlags
|
||||
import android.content.pm.FeatureFlagsImpl as PmFeatureFlagsImpl
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
@@ -34,7 +34,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||
fun AppButtons(
|
||||
packageInfoPresenter: PackageInfoPresenter,
|
||||
isHibernationSwitchEnabledStateFlow: MutableStateFlow<Boolean>,
|
||||
featureFlags: FeatureFlags = FeatureFlagsImpl()
|
||||
featureFlags: PmFeatureFlags = PmFeatureFlagsImpl()
|
||||
) {
|
||||
if (remember(packageInfoPresenter) { packageInfoPresenter.isMainlineModule() }) return
|
||||
val presenter = remember {
|
||||
@@ -53,7 +53,7 @@ private fun PackageInfoPresenter.isMainlineModule(): Boolean =
|
||||
private class AppButtonsPresenter(
|
||||
private val packageInfoPresenter: PackageInfoPresenter,
|
||||
isHibernationSwitchEnabledStateFlow: MutableStateFlow<Boolean>,
|
||||
private val featureFlags: FeatureFlags
|
||||
private val featureFlags: PmFeatureFlags
|
||||
) {
|
||||
private val appLaunchButton = AppLaunchButton(packageInfoPresenter)
|
||||
private val appInstallButton = AppInstallButton(packageInfoPresenter)
|
||||
|
@@ -18,9 +18,8 @@ package com.android.settings.spa.app.appinfo
|
||||
|
||||
import android.app.settings.SettingsEnums
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.pm.FeatureFlags
|
||||
import android.content.pm.FeatureFlagsImpl
|
||||
import android.os.Bundle
|
||||
import android.os.SystemProperties
|
||||
import android.os.UserHandle
|
||||
import android.util.FeatureFlagUtils
|
||||
import androidx.compose.runtime.Composable
|
||||
@@ -51,6 +50,8 @@ import com.android.settingslib.spa.widget.ui.Category
|
||||
import com.android.settingslib.spaprivileged.model.app.toRoute
|
||||
import com.android.settingslib.spaprivileged.template.app.AppInfoProvider
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import android.content.pm.FeatureFlags as PmFeatureFlags
|
||||
import android.content.pm.FeatureFlagsImpl as PmFeatureFlagsImpl
|
||||
|
||||
private const val PACKAGE_NAME = "packageName"
|
||||
private const val USER_ID = "userId"
|
||||
@@ -121,7 +122,7 @@ object AppInfoSettingsProvider : SettingsPageProvider {
|
||||
@Composable
|
||||
private fun AppInfoSettings(packageInfoPresenter: PackageInfoPresenter) {
|
||||
val packageInfoState = packageInfoPresenter.flow.collectAsStateWithLifecycle()
|
||||
val featureFlags: FeatureFlags = FeatureFlagsImpl()
|
||||
val featureFlags: PmFeatureFlags = PmFeatureFlagsImpl()
|
||||
RegularScaffold(
|
||||
title = stringResource(R.string.application_info_label),
|
||||
actions = {
|
||||
@@ -177,5 +178,6 @@ private fun AppInfoSettings(packageInfoPresenter: PackageInfoPresenter) {
|
||||
}
|
||||
}
|
||||
|
||||
fun isArchivingEnabled(featureFlags: FeatureFlags) =
|
||||
featureFlags.archiving() || "true" == System.getProperty("pm.archiving.enabled")
|
||||
fun isArchivingEnabled(featureFlags: PmFeatureFlags) =
|
||||
featureFlags.archiving() || SystemProperties.getBoolean("pm.archiving.enabled", false)
|
||||
|| Flags.appArchiving()
|
@@ -22,8 +22,9 @@ import android.app.AppOpsManager.MODE_IGNORED
|
||||
import android.app.AppOpsManager.OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED
|
||||
import android.content.Context
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.pm.Flags
|
||||
import android.content.pm.Flags as PmFlags
|
||||
import android.os.Build
|
||||
import android.os.SystemProperties
|
||||
import android.permission.PermissionControllerManager.HIBERNATION_ELIGIBILITY_EXEMPT_BY_SYSTEM
|
||||
import android.permission.PermissionControllerManager.HIBERNATION_ELIGIBILITY_UNKNOWN
|
||||
import android.provider.DeviceConfig
|
||||
@@ -36,6 +37,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.android.settings.R
|
||||
import com.android.settings.Utils.PROPERTY_APP_HIBERNATION_ENABLED
|
||||
import com.android.settings.Utils.PROPERTY_HIBERNATION_TARGETS_PRE_S_APPS
|
||||
import com.android.settings.flags.Flags
|
||||
import com.android.settingslib.spa.framework.compose.OverridableFlow
|
||||
import com.android.settingslib.spa.widget.preference.SwitchPreference
|
||||
import com.android.settingslib.spa.widget.preference.SwitchPreferenceModel
|
||||
@@ -91,7 +93,8 @@ fun HibernationSwitchPreference(
|
||||
}
|
||||
|
||||
private fun isArchivingEnabled() =
|
||||
Flags.archiving() || "true" == System.getProperty("pm.archiving.enabled")
|
||||
PmFlags.archiving() || SystemProperties.getBoolean("pm.archiving.enabled", false)
|
||||
|| Flags.appArchiving()
|
||||
|
||||
private class HibernationSwitchPresenter(context: Context, private val app: ApplicationInfo) {
|
||||
private val appOpsManager = context.appOpsManager
|
||||
|
@@ -20,14 +20,16 @@ import android.app.settings.SettingsEnums
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.pm.FeatureFlags
|
||||
import android.content.pm.FeatureFlagsImpl
|
||||
import android.content.pm.FeatureFlags as PmFeatureFlags
|
||||
import android.content.pm.FeatureFlagsImpl as PmFeatureFlagsImpl
|
||||
import android.content.pm.PackageInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.UserHandle
|
||||
import android.util.Log
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.compose.runtime.Composable
|
||||
import com.android.settings.flags.FeatureFlags
|
||||
import com.android.settings.flags.FeatureFlagsImpl
|
||||
import com.android.settings.overlay.FeatureFactory.Companion.featureFactory
|
||||
import com.android.settings.spa.app.startUninstallActivity
|
||||
import com.android.settingslib.spa.framework.compose.LocalNavController
|
||||
@@ -60,7 +62,7 @@ class PackageInfoPresenter(
|
||||
val userId: Int,
|
||||
private val coroutineScope: CoroutineScope,
|
||||
private val packageManagers: IPackageManagers = PackageManagers,
|
||||
private val featureFlags: FeatureFlags = FeatureFlagsImpl(),
|
||||
private val featureFlags: PmFeatureFlags = PmFeatureFlagsImpl(),
|
||||
) {
|
||||
private val metricsFeatureProvider = featureFactory.metricsFeatureProvider
|
||||
private val userHandle = UserHandle.of(userId)
|
||||
|
@@ -27,7 +27,8 @@ import android.os.PowerExemptionManager
|
||||
import androidx.compose.runtime.Composable
|
||||
import com.android.settings.overlay.FeatureFactory.Companion.featureFactory
|
||||
import com.android.settingslib.R
|
||||
import com.android.settingslib.spa.livedata.observeAsCallback
|
||||
import com.android.settingslib.spa.lifecycle.collectAsCallbackWithLifecycle
|
||||
import com.android.settingslib.spaprivileged.model.app.AppOpsController
|
||||
import com.android.settingslib.spaprivileged.model.app.AppRecord
|
||||
import com.android.settingslib.spaprivileged.model.app.IPackageManagers
|
||||
import com.android.settingslib.spaprivileged.model.app.PackageManagers
|
||||
@@ -47,7 +48,7 @@ data class AlarmsAndRemindersAppRecord(
|
||||
override val app: ApplicationInfo,
|
||||
val isTrumped: Boolean,
|
||||
val isChangeable: Boolean,
|
||||
var controller: AlarmsAndRemindersController,
|
||||
var controller: AppOpsController,
|
||||
) : AppRecord
|
||||
|
||||
class AlarmsAndRemindersAppListModel(
|
||||
@@ -82,7 +83,7 @@ class AlarmsAndRemindersAppListModel(
|
||||
@Composable
|
||||
override fun isAllowed(record: AlarmsAndRemindersAppRecord): () -> Boolean? = when {
|
||||
record.isTrumped -> ({ true })
|
||||
else -> record.controller.isAllowed.observeAsCallback()
|
||||
else -> record.controller.isAllowed.collectAsCallbackWithLifecycle()
|
||||
}
|
||||
|
||||
override fun isChangeable(record: AlarmsAndRemindersAppRecord) = record.isChangeable
|
||||
@@ -112,7 +113,12 @@ class AlarmsAndRemindersAppListModel(
|
||||
app = app,
|
||||
isTrumped = isTrumped,
|
||||
isChangeable = hasRequestPermission && !isTrumped,
|
||||
controller = AlarmsAndRemindersController(context, app),
|
||||
controller = AppOpsController(
|
||||
context = context,
|
||||
app = app,
|
||||
op = AppOpsManager.OP_SCHEDULE_EXACT_ALARM,
|
||||
setModeByUid = true,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.spa.app.specialaccess
|
||||
|
||||
import android.app.AppOpsManager
|
||||
import android.app.AppOpsManager.MODE_ALLOWED
|
||||
import android.app.AppOpsManager.MODE_ERRORED
|
||||
import android.content.Context
|
||||
import android.content.pm.ApplicationInfo
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.android.settingslib.spaprivileged.framework.common.alarmManager
|
||||
import com.android.settingslib.spaprivileged.framework.common.appOpsManager
|
||||
import com.android.settingslib.spaprivileged.model.app.userId
|
||||
|
||||
class AlarmsAndRemindersController(
|
||||
context: Context,
|
||||
private val app: ApplicationInfo,
|
||||
) {
|
||||
private val alarmManager = context.alarmManager
|
||||
private val appOpsManager = context.appOpsManager
|
||||
|
||||
val isAllowed: LiveData<Boolean>
|
||||
get() = _allowed
|
||||
|
||||
fun setAllowed(allowed: Boolean) {
|
||||
val mode = if (allowed) MODE_ALLOWED else MODE_ERRORED
|
||||
appOpsManager.setUidMode(AppOpsManager.OP_SCHEDULE_EXACT_ALARM, app.uid, mode)
|
||||
_allowed.postValue(allowed)
|
||||
}
|
||||
|
||||
private val _allowed = object : MutableLiveData<Boolean>() {
|
||||
override fun onActive() {
|
||||
postValue(alarmManager.hasScheduleExactAlarm(app.packageName, app.userId))
|
||||
}
|
||||
}
|
||||
}
|
@@ -1771,6 +1771,9 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
.updateNonIndexableKeys(niks);
|
||||
new AutoSyncWorkDataPreferenceController(context, null /* parent */)
|
||||
.updateNonIndexableKeys(niks);
|
||||
if (suppressAllPage) {
|
||||
niks.add(KEY_ALLOW_MULTIPLE_USERS);
|
||||
}
|
||||
return niks;
|
||||
}
|
||||
};
|
||||
|
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.settings.development
|
||||
|
||||
import android.content.Context
|
||||
import android.platform.test.annotations.RequiresFlagsDisabled
|
||||
import android.platform.test.annotations.RequiresFlagsEnabled
|
||||
import android.platform.test.flag.junit.DeviceFlagsValueProvider
|
||||
import android.provider.Settings
|
||||
import android.provider.Settings.Global.DISABLE_SCREEN_SHARE_PROTECTIONS_FOR_APPS_AND_NOTIFICATIONS
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceScreen
|
||||
import androidx.preference.SwitchPreference
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.android.server.notification.Flags.FLAG_SCREENSHARE_NOTIFICATION_HIDING
|
||||
import com.android.server.notification.Flags.FLAG_SENSITIVE_NOTIFICATION_APP_PROTECTION
|
||||
import com.android.settings.development.SensitiveContentProtectionPreferenceController.Companion.SETTING_VALUE_OFF
|
||||
import com.android.settings.development.SensitiveContentProtectionPreferenceController.Companion.SETTING_VALUE_ON
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.verify
|
||||
import org.mockito.junit.MockitoJUnit
|
||||
import org.mockito.Mockito.`when` as whenever
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class SensitiveContentProtectionPreferenceControllerTest {
|
||||
@get:Rule
|
||||
val mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule()
|
||||
|
||||
@get:Rule
|
||||
val mocks = MockitoJUnit.rule()
|
||||
|
||||
@Mock
|
||||
private lateinit var preference: SwitchPreference
|
||||
|
||||
@Mock
|
||||
private lateinit var screen: PreferenceScreen
|
||||
|
||||
private val context: Context = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
private lateinit var controller: SensitiveContentProtectionPreferenceController
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
controller = SensitiveContentProtectionPreferenceController(context)
|
||||
whenever(screen.findPreference<Preference>(controller.getPreferenceKey()))
|
||||
.thenReturn(preference)
|
||||
controller.displayPreference(screen)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onPreferenceChange_settingEnabled_shouldDisableSensitiveContentProtection() {
|
||||
controller.onPreferenceChange(preference, true /* new value */)
|
||||
val mode = Settings.Global.getInt(
|
||||
context.contentResolver,
|
||||
DISABLE_SCREEN_SHARE_PROTECTIONS_FOR_APPS_AND_NOTIFICATIONS,
|
||||
-1 /* default */
|
||||
)
|
||||
|
||||
assertEquals(mode, SETTING_VALUE_ON)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onPreferenceChange_settingDisabled_shouldEnableSensitiveContentProtection() {
|
||||
controller.onPreferenceChange(preference, false /* new value */)
|
||||
val mode = Settings.Global.getInt(
|
||||
context.contentResolver,
|
||||
DISABLE_SCREEN_SHARE_PROTECTIONS_FOR_APPS_AND_NOTIFICATIONS,
|
||||
-1 /* default */
|
||||
)
|
||||
|
||||
assertEquals(mode, SETTING_VALUE_OFF)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun updateState_settingEnabled_preferenceShouldBeChecked() {
|
||||
Settings.Global.putInt(
|
||||
context.contentResolver,
|
||||
DISABLE_SCREEN_SHARE_PROTECTIONS_FOR_APPS_AND_NOTIFICATIONS,
|
||||
SETTING_VALUE_ON
|
||||
)
|
||||
controller.updateState(preference)
|
||||
|
||||
verify(preference).isChecked = true
|
||||
}
|
||||
|
||||
@Test
|
||||
fun updateState_settingDisabled_preferenceShouldNotBeChecked() {
|
||||
Settings.Global.putInt(
|
||||
context.contentResolver,
|
||||
DISABLE_SCREEN_SHARE_PROTECTIONS_FOR_APPS_AND_NOTIFICATIONS,
|
||||
SETTING_VALUE_OFF
|
||||
)
|
||||
controller.updateState(preference)
|
||||
|
||||
verify(preference).isChecked = false
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onDeveloperOptionsSwitchDisabled_preferenceShouldBeDisabled() {
|
||||
controller.onDeveloperOptionsSwitchDisabled()
|
||||
val mode = Settings.Global.getInt(
|
||||
context.contentResolver,
|
||||
DISABLE_SCREEN_SHARE_PROTECTIONS_FOR_APPS_AND_NOTIFICATIONS,
|
||||
-1 /* default */
|
||||
)
|
||||
|
||||
assertEquals(mode, SETTING_VALUE_OFF)
|
||||
verify(preference).isChecked = false
|
||||
verify(preference).isEnabled = false
|
||||
}
|
||||
|
||||
@Test
|
||||
@RequiresFlagsDisabled(
|
||||
FLAG_SENSITIVE_NOTIFICATION_APP_PROTECTION,
|
||||
FLAG_SCREENSHARE_NOTIFICATION_HIDING)
|
||||
fun isAvailable_flagsDisabled_returnFalse() {
|
||||
assertFalse(controller.isAvailable)
|
||||
}
|
||||
|
||||
@Test
|
||||
@RequiresFlagsEnabled(FLAG_SENSITIVE_NOTIFICATION_APP_PROTECTION)
|
||||
fun isAvailable_sensitiveNotificationAppProtectionEnabled_returnTrue() {
|
||||
assertTrue(controller.isAvailable)
|
||||
}
|
||||
|
||||
@Test
|
||||
@RequiresFlagsEnabled(FLAG_SCREENSHARE_NOTIFICATION_HIDING)
|
||||
fun isAvailable_screenshareNotificationHidingEnabled_returnTrue() {
|
||||
assertTrue(controller.isAvailable)
|
||||
}
|
||||
}
|
@@ -24,8 +24,9 @@ import android.app.AppOpsManager.OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED
|
||||
import android.apphibernation.AppHibernationManager
|
||||
import android.content.Context
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.pm.Flags
|
||||
import android.content.pm.Flags as PmFlags
|
||||
import android.os.Build
|
||||
import android.os.SystemProperties
|
||||
import android.permission.PermissionControllerManager
|
||||
import android.permission.PermissionControllerManager.HIBERNATION_ELIGIBILITY_ELIGIBLE
|
||||
import android.permission.PermissionControllerManager.HIBERNATION_ELIGIBILITY_EXEMPT_BY_SYSTEM
|
||||
@@ -48,6 +49,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.android.settings.R
|
||||
import com.android.settings.Utils.PROPERTY_APP_HIBERNATION_ENABLED
|
||||
import com.android.settings.Utils.PROPERTY_HIBERNATION_TARGETS_PRE_S_APPS
|
||||
import com.android.settings.flags.Flags
|
||||
import com.android.settings.testutils.TestDeviceConfig
|
||||
import com.android.settings.testutils.mockAsUser
|
||||
import com.android.settingslib.spaprivileged.framework.common.appHibernationManager
|
||||
@@ -161,8 +163,8 @@ class HibernationSwitchPreferenceTest {
|
||||
}
|
||||
|
||||
private fun isArchivingEnabled() =
|
||||
Flags.archiving() || "true" == System.getProperty("pm.archiving.enabled")
|
||||
|
||||
PmFlags.archiving() || SystemProperties.getBoolean("pm.archiving.enabled", false)
|
||||
|| Flags.appArchiving()
|
||||
@Test
|
||||
fun `An app targets Q with ops mode default when hibernation targets pre S - not exempted`() {
|
||||
mockOpsMode(MODE_DEFAULT)
|
||||
|
@@ -114,7 +114,7 @@ public class BiometricsSafetySourceTest {
|
||||
|
||||
@Test
|
||||
public void setSafetySourceData_whenSafetyCenterIsEnabled_withoutBiometrics_setsNullData() {
|
||||
when(mSafetyCenterManagerWrapper.isEnabled(mApplicationContext)).thenReturn(false);
|
||||
when(mSafetyCenterManagerWrapper.isEnabled(mApplicationContext)).thenReturn(true);
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
|
||||
when(mFaceManager.isHardwareDetected()).thenReturn(false);
|
||||
|
||||
|
@@ -413,6 +413,8 @@ public class LockScreenSafetySourceTest {
|
||||
when(mSafetyCenterManagerWrapper.isEnabled(mApplicationContext)).thenReturn(true);
|
||||
when(mScreenLockPreferenceDetailsUtils.isPasswordQualityManaged(anyInt(), any()))
|
||||
.thenReturn(false);
|
||||
when(mScreenLockPreferenceDetailsUtils.isLockPatternSecure()).thenReturn(true);
|
||||
when(mScreenLockPreferenceDetailsUtils.shouldShowGearMenu()).thenReturn(true);
|
||||
|
||||
LockScreenSafetySource.setSafetySourceData(
|
||||
mApplicationContext, mScreenLockPreferenceDetailsUtils, EVENT_SOURCE_STATE_CHANGED);
|
||||
|
@@ -107,7 +107,7 @@ public class SecurityAdvancedSettingsTest {
|
||||
|
||||
@Test
|
||||
public void whenSafetyCenterIsEnabled_pageIndexExcluded() throws Exception {
|
||||
when(mSafetyCenterManagerWrapper.isEnabled(any())).thenReturn(false);
|
||||
when(mSafetyCenterManagerWrapper.isEnabled(any())).thenReturn(true);
|
||||
BaseSearchIndexProvider indexProvider = SecurityAdvancedSettings.SEARCH_INDEX_DATA_PROVIDER;
|
||||
|
||||
List<String> allXmlKeys = TestUtils.getAllXmlKeys(mContext, indexProvider);
|
||||
|
Reference in New Issue
Block a user