Merge "Change Never Option to lock private space after device restart" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
7e3d30c95f
@@ -1529,7 +1529,7 @@
|
|||||||
<string-array name="private_space_auto_lock_options">
|
<string-array name="private_space_auto_lock_options">
|
||||||
<item>@string/private_space_auto_lock_every_time</item>
|
<item>@string/private_space_auto_lock_every_time</item>
|
||||||
<item>@string/private_space_auto_lock_after_inactivity</item>
|
<item>@string/private_space_auto_lock_after_inactivity</item>
|
||||||
<item>@string/private_space_auto_lock_never</item>
|
<item>@string/private_space_auto_lock_after_device_restart</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<!-- Values for private space auto lock option -->
|
<!-- Values for private space auto lock option -->
|
||||||
|
@@ -1257,8 +1257,8 @@
|
|||||||
<string name="private_space_auto_lock_every_time">Every time device locks</string>
|
<string name="private_space_auto_lock_every_time">Every time device locks</string>
|
||||||
<!-- Configure auto lock: Value for auto lock configuration to lock private space after 5 minutes of inactivity. [CHAR LIMIT=40] -->
|
<!-- Configure auto lock: Value for auto lock configuration to lock private space after 5 minutes of inactivity. [CHAR LIMIT=40] -->
|
||||||
<string name="private_space_auto_lock_after_inactivity">After 5 minutes of inactivity</string>
|
<string name="private_space_auto_lock_after_inactivity">After 5 minutes of inactivity</string>
|
||||||
<!-- Configure auto lock: Value for auto lock configuration to never lock private space. [CHAR LIMIT=20] -->
|
<!-- Configure auto lock: Value for auto lock configuration to lock private space only after device restarts. [CHAR LIMIT=40] -->
|
||||||
<string name="private_space_auto_lock_never">Never</string>
|
<string name="private_space_auto_lock_after_device_restart">Only after device restarts</string>
|
||||||
<!-- Title for the settings preference and settings page for hide private space when locked setting. [CHAR LIMIT=60] -->
|
<!-- Title for the settings preference and settings page for hide private space when locked setting. [CHAR LIMIT=60] -->
|
||||||
<string name="private_space_hide_page_title">Hide private space when it\'s locked</string>
|
<string name="private_space_hide_page_title">Hide private space when it\'s locked</string>
|
||||||
<!-- Description for hide Private Space settings page. [CHAR LIMIT=NONE] -->
|
<!-- Description for hide Private Space settings page. [CHAR LIMIT=NONE] -->
|
||||||
|
@@ -19,7 +19,7 @@ package com.android.settings.privatespace;
|
|||||||
import static android.os.UserManager.USER_TYPE_PROFILE_PRIVATE;
|
import static android.os.UserManager.USER_TYPE_PROFILE_PRIVATE;
|
||||||
import static android.provider.Settings.Secure.HIDE_PRIVATESPACE_ENTRY_POINT;
|
import static android.provider.Settings.Secure.HIDE_PRIVATESPACE_ENTRY_POINT;
|
||||||
import static android.provider.Settings.Secure.PRIVATE_SPACE_AUTO_LOCK;
|
import static android.provider.Settings.Secure.PRIVATE_SPACE_AUTO_LOCK;
|
||||||
import static android.provider.Settings.Secure.PRIVATE_SPACE_AUTO_LOCK_NEVER;
|
import static android.provider.Settings.Secure.PRIVATE_SPACE_AUTO_LOCK_AFTER_DEVICE_RESTART;
|
||||||
import static android.provider.Settings.Secure.USER_SETUP_COMPLETE;
|
import static android.provider.Settings.Secure.USER_SETUP_COMPLETE;
|
||||||
|
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
@@ -63,7 +63,8 @@ public class PrivateSpaceMaintainer {
|
|||||||
public static final int HIDE_PRIVATE_SPACE_ENTRY_POINT_ENABLED_VAL = 1;
|
public static final int HIDE_PRIVATE_SPACE_ENTRY_POINT_ENABLED_VAL = 1;
|
||||||
/** Default value for private space auto lock settings. */
|
/** Default value for private space auto lock settings. */
|
||||||
@Settings.Secure.PrivateSpaceAutoLockOption
|
@Settings.Secure.PrivateSpaceAutoLockOption
|
||||||
public static final int PRIVATE_SPACE_AUTO_LOCK_DEFAULT_VAL = PRIVATE_SPACE_AUTO_LOCK_NEVER;
|
public static final int PRIVATE_SPACE_AUTO_LOCK_DEFAULT_VAL =
|
||||||
|
PRIVATE_SPACE_AUTO_LOCK_AFTER_DEVICE_RESTART;
|
||||||
|
|
||||||
public enum ErrorDeletingPrivateSpace {
|
public enum ErrorDeletingPrivateSpace {
|
||||||
DELETE_PS_ERROR_NONE,
|
DELETE_PS_ERROR_NONE,
|
||||||
|
@@ -130,9 +130,12 @@ public class AutoLockPreferenceControllerTest {
|
|||||||
.isEqualTo("After 5 minutes of inactivity");
|
.isEqualTo("After 5 minutes of inactivity");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Tests that auto lock preference displays the correct summary for option - Never. */
|
/**
|
||||||
|
* Tests that auto lock preference displays the correct summary for option - Only after device
|
||||||
|
* restarts.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void getSummary_whenOptionNever_returnsNever() {
|
public void getSummary_whenOptionAfterDeviceRestart_returnsOnlyAfterDeviceRestarts() {
|
||||||
mSetFlagsRule.enableFlags(
|
mSetFlagsRule.enableFlags(
|
||||||
Flags.FLAG_ALLOW_PRIVATE_PROFILE,
|
Flags.FLAG_ALLOW_PRIVATE_PROFILE,
|
||||||
android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE,
|
android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE,
|
||||||
@@ -141,7 +144,8 @@ public class AutoLockPreferenceControllerTest {
|
|||||||
Settings.Secure.putInt(
|
Settings.Secure.putInt(
|
||||||
mContentResolver,
|
mContentResolver,
|
||||||
Settings.Secure.PRIVATE_SPACE_AUTO_LOCK,
|
Settings.Secure.PRIVATE_SPACE_AUTO_LOCK,
|
||||||
Settings.Secure.PRIVATE_SPACE_AUTO_LOCK_NEVER);
|
Settings.Secure.PRIVATE_SPACE_AUTO_LOCK_AFTER_DEVICE_RESTART);
|
||||||
assertThat(mAutoLockPreferenceController.getSummary().toString()).isEqualTo("Never");
|
assertThat(mAutoLockPreferenceController.getSummary().toString())
|
||||||
|
.isEqualTo("Only after device restarts");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,8 +17,8 @@
|
|||||||
package com.android.settings.privatespace.autolock;
|
package com.android.settings.privatespace.autolock;
|
||||||
|
|
||||||
import static android.provider.Settings.Secure.PRIVATE_SPACE_AUTO_LOCK;
|
import static android.provider.Settings.Secure.PRIVATE_SPACE_AUTO_LOCK;
|
||||||
|
import static android.provider.Settings.Secure.PRIVATE_SPACE_AUTO_LOCK_AFTER_DEVICE_RESTART;
|
||||||
import static android.provider.Settings.Secure.PRIVATE_SPACE_AUTO_LOCK_AFTER_INACTIVITY;
|
import static android.provider.Settings.Secure.PRIVATE_SPACE_AUTO_LOCK_AFTER_INACTIVITY;
|
||||||
import static android.provider.Settings.Secure.PRIVATE_SPACE_AUTO_LOCK_NEVER;
|
|
||||||
import static android.provider.Settings.Secure.PRIVATE_SPACE_AUTO_LOCK_ON_DEVICE_LOCK;
|
import static android.provider.Settings.Secure.PRIVATE_SPACE_AUTO_LOCK_ON_DEVICE_LOCK;
|
||||||
|
|
||||||
import static com.android.settings.privatespace.PrivateSpaceMaintainer.PRIVATE_SPACE_AUTO_LOCK_DEFAULT_VAL;
|
import static com.android.settings.privatespace.PrivateSpaceMaintainer.PRIVATE_SPACE_AUTO_LOCK_DEFAULT_VAL;
|
||||||
@@ -128,7 +128,9 @@ public class AutoLockSettingsFragmentTest {
|
|||||||
mFragment.onAttach(mContext);
|
mFragment.onAttach(mContext);
|
||||||
|
|
||||||
Settings.Secure.putInt(
|
Settings.Secure.putInt(
|
||||||
mContentResolver, PRIVATE_SPACE_AUTO_LOCK, PRIVATE_SPACE_AUTO_LOCK_NEVER);
|
mContentResolver,
|
||||||
|
PRIVATE_SPACE_AUTO_LOCK,
|
||||||
|
PRIVATE_SPACE_AUTO_LOCK_AFTER_DEVICE_RESTART);
|
||||||
assertThat(mFragment.getDefaultKey()).isEqualTo("2");
|
assertThat(mFragment.getDefaultKey()).isEqualTo("2");
|
||||||
|
|
||||||
Settings.Secure.putInt(
|
Settings.Secure.putInt(
|
||||||
@@ -153,7 +155,7 @@ public class AutoLockSettingsFragmentTest {
|
|||||||
mFragment.onAttach(mContext);
|
mFragment.onAttach(mContext);
|
||||||
mFragment.setDefaultKey("2");
|
mFragment.setDefaultKey("2");
|
||||||
assertThat(Settings.Secure.getInt(mContentResolver, PRIVATE_SPACE_AUTO_LOCK, -1))
|
assertThat(Settings.Secure.getInt(mContentResolver, PRIVATE_SPACE_AUTO_LOCK, -1))
|
||||||
.isEqualTo(PRIVATE_SPACE_AUTO_LOCK_NEVER);
|
.isEqualTo(PRIVATE_SPACE_AUTO_LOCK_AFTER_DEVICE_RESTART);
|
||||||
|
|
||||||
mFragment.setDefaultKey("1");
|
mFragment.setDefaultKey("1");
|
||||||
assertThat(Settings.Secure.getInt(mContentResolver, PRIVATE_SPACE_AUTO_LOCK, -1))
|
assertThat(Settings.Secure.getInt(mContentResolver, PRIVATE_SPACE_AUTO_LOCK, -1))
|
||||||
|
Reference in New Issue
Block a user