Remove security settings v1 code
Change-Id: I958ed1588009b91f64cd8ecb98208e72a891903e Fixes: 32953042 Test: robotests
This commit is contained in:
@@ -1279,7 +1279,7 @@
|
||||
android:value="true" />
|
||||
</activity>
|
||||
|
||||
<activity android:name="Settings$SecuritySettingsActivity"
|
||||
<activity android:name=".Settings$SecurityDashboardActivity"
|
||||
android:label="@string/security_settings_title"
|
||||
android:icon="@drawable/ic_homepage_security"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
@@ -1306,28 +1306,6 @@
|
||||
android:value="true" />
|
||||
</activity>
|
||||
|
||||
<!-- TODO(32953042) Merge with Settings$SecuritySettingsActivity -->
|
||||
<activity android:name="Settings$SecuritySettingsActivityV2"
|
||||
android:label="@string/security_settings_title"
|
||||
android:icon="@drawable/ic_homepage_security"
|
||||
android:enabled="false"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:taskAffinity=""
|
||||
android:parentActivityName="Settings">
|
||||
<intent-filter android:priority="-1">
|
||||
<action android:name="android.settings.SECURITY_SETTINGS" />
|
||||
<action android:name="android.credentials.UNLOCK" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter android:priority="4">
|
||||
<action android:name="com.android.settings.action.SETTINGS" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="com.android.settings.category"
|
||||
android:value="com.android.settings.category.ia.homepage" />
|
||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||
android:value="com.android.settings.security.SecuritySettingsV2" />
|
||||
</activity>
|
||||
|
||||
<activity android:name="MonitoringCertInfoActivity"
|
||||
android:label=""
|
||||
android:theme="@style/Transparent"
|
||||
@@ -1358,16 +1336,6 @@
|
||||
android:value="true" />
|
||||
</activity>
|
||||
|
||||
<!-- Keep compatibility with old shortcuts. -->
|
||||
<activity-alias android:name="SecuritySettings"
|
||||
android:label="@string/security_settings_title"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:exported="true"
|
||||
android:targetActivity="Settings$SecuritySettingsActivity">
|
||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||
android:value="com.android.settings.security.SecuritySettings" />
|
||||
</activity-alias>
|
||||
|
||||
<activity android:name="Settings$PrivacySettingsActivity"
|
||||
android:label="@string/privacy_settings_title"
|
||||
android:icon="@drawable/ic_settings_backup"
|
||||
@@ -1405,7 +1373,7 @@
|
||||
<activity android:name="Settings$DeviceAdminSettingsActivity"
|
||||
android:label="@string/device_admin_settings_title"
|
||||
android:taskAffinity="com.android.settings"
|
||||
android:parentActivityName="Settings$SecuritySettingsActivity">
|
||||
android:parentActivityName=".Settings$SecurityDashboardActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
@@ -1436,7 +1404,7 @@
|
||||
<activity android:name="Settings$UsageAccessSettingsActivity"
|
||||
android:label="@string/usage_access_title"
|
||||
android:taskAffinity="com.android.settings"
|
||||
android:parentActivityName="Settings$SecuritySettingsActivity">
|
||||
android:parentActivityName=".Settings$SecurityDashboardActivity">
|
||||
<intent-filter android:priority="1">
|
||||
<action android:name="android.settings.USAGE_ACCESS_SETTINGS" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
@@ -1574,7 +1542,7 @@
|
||||
<activity android:name="Settings$EnterprisePrivacySettingsActivity"
|
||||
android:label="@string/enterprise_privacy_settings"
|
||||
android:taskAffinity="com.android.settings"
|
||||
android:parentActivityName="Settings$SecuritySettingsActivity">
|
||||
android:parentActivityName=".Settings$SecurityDashboardActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.settings.ENTERPRISE_PRIVACY_SETTINGS" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2008 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="security_dashboard_page"
|
||||
android:title="@string/security_settings_title"
|
||||
settings:initialExpandedChildrenCount="9">
|
||||
|
||||
</PreferenceScreen>
|
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="security_settings_chooser_screen"
|
||||
android:title="@string/security_settings_title">
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="security_category"
|
||||
android:title="@string/lock_settings_title">
|
||||
|
||||
<com.android.settings.widget.GearPreference
|
||||
android:key="unlock_set_or_change"
|
||||
android:title="@string/unlock_set_unlock_launch_picker_title"
|
||||
android:summary="@string/unlock_set_unlock_mode_none"
|
||||
settings:keywords="@string/keywords_lockscreen"
|
||||
android:persistent="false"/>
|
||||
|
||||
<Preference android:key="lockscreen_preferences"
|
||||
android:title="@string/lockscreen_settings_title"
|
||||
android:fragment="com.android.settings.security.LockscreenDashboardFragment"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="security_settings_lockscreen_screen"
|
||||
android:title="@string/security_settings_title">
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="security_category"
|
||||
android:title="@string/lock_settings_title">
|
||||
|
||||
<com.android.settingslib.RestrictedPreference
|
||||
android:key="unlock_set_or_change"
|
||||
android:title="@string/unlock_set_unlock_launch_picker_title"
|
||||
android:summary="@string/unlock_set_unlock_mode_off"
|
||||
settings:keywords="@string/keywords_lockscreen"
|
||||
android:persistent="false"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="security_settings_lockscreen_profile_screen"
|
||||
android:title="@string/security_settings_title">
|
||||
|
||||
<com.android.settingslib.RestrictedPreference
|
||||
android:key="unlock_set_or_change_profile"
|
||||
android:title="@string/unlock_set_unlock_launch_picker_title_profile"
|
||||
android:summary="@string/unlock_set_unlock_mode_off"
|
||||
settings:keywords="@string/keywords_lockscreen"
|
||||
android:persistent="false"/>
|
||||
|
||||
</PreferenceScreen>
|
@@ -1,88 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2011 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:key="security_settings_misc_screen"
|
||||
android:title="@string/security_settings_title">
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="security_settings_misc_category"
|
||||
android:title="@string/security_passwords_title">
|
||||
|
||||
<Preference
|
||||
android:key="location"
|
||||
android:title="@string/location_settings_title"
|
||||
android:fragment="com.android.settings.location.LocationSettings">
|
||||
</Preference>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="show_password"
|
||||
android:title="@string/show_password"
|
||||
android:summary="@string/show_password_summary"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="security_settings_device_admin_category">
|
||||
|
||||
<Preference android:key="manage_device_admin"
|
||||
android:title="@string/manage_device_admin"
|
||||
android:persistent="false"
|
||||
android:fragment="com.android.settings.DeviceAdminSettings"/>
|
||||
|
||||
<Preference android:key="enterprise_privacy"
|
||||
android:title="@string/enterprise_privacy_settings"
|
||||
android:persistent="false"
|
||||
android:fragment="com.android.settings.enterprise.EnterprisePrivacySettings"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<Preference android:key="sim_lock_settings"
|
||||
android:title="@string/sim_lock_settings_category"
|
||||
android:persistent="false">
|
||||
|
||||
<intent android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="com.android.settings"
|
||||
android:targetClass="com.android.settings.Settings$IccLockSettingsActivity"/>
|
||||
|
||||
</Preference>
|
||||
|
||||
<Preference
|
||||
android:key="encryption_and_credential"
|
||||
android:title="@string/encryption_and_credential_settings_title"
|
||||
android:summary="@string/encryption_and_credential_settings_summary"
|
||||
android:fragment="com.android.settings.security.EncryptionAndCredential"/>
|
||||
|
||||
<Preference android:key="manage_trust_agents"
|
||||
android:title="@string/manage_trust_agents"
|
||||
android:persistent="false"
|
||||
android:fragment="com.android.settings.security.trustagent.TrustAgentSettings"/>
|
||||
|
||||
<Preference
|
||||
android:key="screen_pinning_settings"
|
||||
android:title="@string/screen_pinning_title"
|
||||
android:summary="@string/switch_off_text"
|
||||
android:fragment="com.android.settings.security.ScreenPinningSettings"/>
|
||||
|
||||
<Preference android:key="security_misc_usage_access"
|
||||
android:title="@string/usage_access_title"
|
||||
android:fragment="com.android.settings.applications.manageapplications.ManageApplications">
|
||||
<extra
|
||||
android:name="classname"
|
||||
android:value="com.android.settings.Settings$UsageAccessSettingsActivity" />
|
||||
</Preference>
|
||||
|
||||
</PreferenceScreen>
|
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="security_settings_password_screen"
|
||||
android:title="@string/lock_settings_picker_title">
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="security_category"
|
||||
android:title="@string/lock_settings_title">
|
||||
|
||||
<com.android.settings.widget.GearPreference
|
||||
android:key="unlock_set_or_change"
|
||||
android:title="@string/unlock_set_unlock_launch_picker_title"
|
||||
android:summary="@string/unlock_set_unlock_mode_password"
|
||||
settings:keywords="@string/keywords_lockscreen" />
|
||||
|
||||
<Preference android:key="lockscreen_preferences"
|
||||
android:title="@string/lockscreen_settings_title"
|
||||
android:fragment="com.android.settings.security.LockscreenDashboardFragment"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="security_settings_password_profile_screen"
|
||||
android:title="@string/security_settings_title">
|
||||
|
||||
<com.android.settingslib.RestrictedPreference
|
||||
android:key="unlock_set_or_change_profile"
|
||||
android:title="@string/unlock_set_unlock_launch_picker_title_profile"
|
||||
android:summary="@string/unlock_set_unlock_mode_password"
|
||||
settings:keywords="@string/keywords_lockscreen"
|
||||
android:persistent="false"/>
|
||||
|
||||
</PreferenceScreen>
|
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="security_settings_pattern_screen"
|
||||
android:title="@string/lock_settings_picker_title">
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="security_category"
|
||||
android:title="@string/lock_settings_title">
|
||||
|
||||
<com.android.settings.widget.GearPreference
|
||||
android:key="unlock_set_or_change"
|
||||
android:title="@string/unlock_set_unlock_launch_picker_title"
|
||||
android:summary="@string/unlock_set_unlock_mode_pattern"
|
||||
settings:keywords="@string/keywords_lockscreen" />
|
||||
|
||||
<Preference android:key="lockscreen_preferences"
|
||||
android:title="@string/lockscreen_settings_title"
|
||||
android:fragment="com.android.settings.security.LockscreenDashboardFragment"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
@@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="security_settings_pattern_profile_screen"
|
||||
android:title="@string/security_settings_title">
|
||||
|
||||
<com.android.settingslib.RestrictedPreference
|
||||
android:key="unlock_set_or_change_profile"
|
||||
android:title="@string/unlock_set_unlock_launch_picker_title_profile"
|
||||
android:summary="@string/unlock_set_unlock_mode_pattern"
|
||||
settings:keywords="@string/keywords_lockscreen"
|
||||
android:persistent="false"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="visiblepattern_profile"
|
||||
android:title="@string/lockpattern_settings_enable_visible_pattern_title_profile"/>
|
||||
|
||||
</PreferenceScreen>
|
@@ -1,37 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:title="@string/lock_settings_picker_title">
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="security_category"
|
||||
android:title="@string/lock_settings_title">
|
||||
|
||||
<com.android.settings.widget.GearPreference
|
||||
android:key="unlock_set_or_change"
|
||||
android:title="@string/unlock_set_unlock_launch_picker_title"
|
||||
android:summary="@string/unlock_set_unlock_mode_pin"
|
||||
settings:keywords="@string/keywords_lockscreen" />
|
||||
|
||||
<Preference android:key="lockscreen_preferences"
|
||||
android:title="@string/lockscreen_settings_title"
|
||||
android:fragment="com.android.settings.security.LockscreenDashboardFragment"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="security_settings_pin_profile_screen"
|
||||
android:title="@string/security_settings_title">
|
||||
|
||||
<com.android.settingslib.RestrictedPreference
|
||||
android:key="unlock_set_or_change_profile"
|
||||
android:title="@string/unlock_set_unlock_launch_picker_title_profile"
|
||||
android:summary="@string/unlock_set_unlock_mode_pin"
|
||||
settings:keywords="@string/keywords_lockscreen"
|
||||
android:persistent="false"/>
|
||||
|
||||
</PreferenceScreen>
|
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:title="@string/lock_settings_picker_title">
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="security_category_profile"
|
||||
android:title="@string/lock_settings_profile_title">
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2017 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:title="@string/security_settings_title">
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="security_status"
|
||||
android:title="@string/security_status_title"/>
|
||||
|
||||
</PreferenceScreen>
|
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:title="@string/security_settings_title">
|
||||
|
||||
<com.android.settingslib.RestrictedSwitchPreference
|
||||
android:key="unification"
|
||||
android:title="@string/lock_settings_profile_unification_title"
|
||||
android:summary="@string/lock_settings_profile_unification_summary"
|
||||
settings:keywords="@string/keywords_unification"/>
|
||||
|
||||
</PreferenceScreen>
|
@@ -67,8 +67,7 @@ public class Settings extends SettingsActivity {
|
||||
public static class AccessibilityInversionSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class AccessibilityContrastSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class AccessibilityDaltonizerSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class SecuritySettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class SecuritySettingsActivityV2 extends SettingsActivity { /* empty */ }
|
||||
public static class SecurityDashboardActivity extends SettingsActivity { /* empty */ }
|
||||
public static class UsageAccessSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class LocationSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class PrivacySettingsActivity extends SettingsActivity { /* empty */ }
|
||||
|
@@ -802,20 +802,6 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
!isConnectedDeviceV2Enabled && !UserManager.isDeviceInDemoMode(this) /* enabled */,
|
||||
isAdmin) || somethingChanged;
|
||||
|
||||
final boolean isSecurityV2Enabled = featureFactory.getSecurityFeatureProvider()
|
||||
.isSecuritySettingsV2Enabled(this);
|
||||
|
||||
// Enable new security page if v2 enabled
|
||||
somethingChanged = setTileEnabled(
|
||||
new ComponentName(packageName,Settings.SecuritySettingsActivityV2.class.getName()),
|
||||
isSecurityV2Enabled,
|
||||
isAdmin) || somethingChanged;
|
||||
// Enable old security page if v2 disabled
|
||||
somethingChanged = setTileEnabled(
|
||||
new ComponentName(packageName,Settings.SecuritySettingsActivity.class.getName()),
|
||||
!isSecurityV2Enabled,
|
||||
isAdmin) || somethingChanged;
|
||||
|
||||
somethingChanged = setTileEnabled(new ComponentName(packageName,
|
||||
Settings.SimSettingsActivity.class.getName()),
|
||||
Utils.showSimCardTile(this), isAdmin)
|
||||
|
@@ -24,7 +24,6 @@ public class FeatureFlags {
|
||||
public static final String CONNECTED_DEVICE_V2 = "settings_connected_device_v2";
|
||||
public static final String BATTERY_SETTINGS_V2 = "settings_battery_v2";
|
||||
public static final String BATTERY_DISPLAY_APP_LIST = "settings_battery_display_app_list";
|
||||
public static final String SECURITY_SETTINGS_V2 = "settings_security_settings_v2";
|
||||
public static final String ZONE_PICKER_V2 = "settings_zone_picker_v2";
|
||||
public static final String SUGGESTION_UI_V2 = "settings_suggestion_ui_v2";
|
||||
public static final String ABOUT_PHONE_V2 = "settings_about_phone_v2";
|
||||
|
@@ -116,7 +116,6 @@ import com.android.settings.print.PrintSettingsFragment;
|
||||
import com.android.settings.security.CryptKeeperSettings;
|
||||
import com.android.settings.security.LockscreenDashboardFragment;
|
||||
import com.android.settings.security.SecuritySettings;
|
||||
import com.android.settings.security.SecuritySettingsV2;
|
||||
import com.android.settings.sim.SimSettings;
|
||||
import com.android.settings.support.SupportDashboardActivity;
|
||||
import com.android.settings.system.ResetDashboardFragment;
|
||||
@@ -165,7 +164,6 @@ public class SettingsGateway {
|
||||
NotificationStation.class.getName(),
|
||||
LocationSettings.class.getName(),
|
||||
SecuritySettings.class.getName(),
|
||||
SecuritySettingsV2.class.getName(),
|
||||
UsageAccessDetails.class.getName(),
|
||||
PrivacySettings.class.getName(),
|
||||
DeviceAdminSettings.class.getName(),
|
||||
@@ -271,8 +269,7 @@ public class SettingsGateway {
|
||||
Settings.PowerUsageSummaryActivity.class.getName(),
|
||||
Settings.PowerUsageSummaryLegacyActivity.class.getName(),
|
||||
Settings.AccountDashboardActivity.class.getName(),
|
||||
Settings.SecuritySettingsActivity.class.getName(),
|
||||
Settings.SecuritySettingsActivityV2.class.getName(),
|
||||
Settings.SecurityDashboardActivity.class.getName(),
|
||||
Settings.AccessibilitySettingsActivity.class.getName(),
|
||||
Settings.SystemDashboardActivity.class.getName(),
|
||||
SupportDashboardActivity.class.getName(),
|
||||
|
@@ -33,7 +33,7 @@ import com.android.settings.network.NetworkDashboardFragment;
|
||||
import com.android.settings.notification.ConfigureNotificationSettings;
|
||||
import com.android.settings.notification.SoundSettings;
|
||||
import com.android.settings.security.LockscreenDashboardFragment;
|
||||
import com.android.settings.security.SecuritySettingsV2;
|
||||
import com.android.settings.security.SecuritySettings;
|
||||
import com.android.settings.system.SystemDashboardFragment;
|
||||
import com.android.settingslib.drawer.CategoryKey;
|
||||
|
||||
@@ -77,7 +77,7 @@ public class DashboardFragmentRegistry {
|
||||
CategoryKey.CATEGORY_SOUND);
|
||||
PARENT_TO_CATEGORY_KEY_MAP.put(StorageDashboardFragment.class.getName(),
|
||||
CategoryKey.CATEGORY_STORAGE);
|
||||
PARENT_TO_CATEGORY_KEY_MAP.put(SecuritySettingsV2.class.getName(),
|
||||
PARENT_TO_CATEGORY_KEY_MAP.put(SecuritySettings.class.getName(),
|
||||
CategoryKey.CATEGORY_SECURITY);
|
||||
PARENT_TO_CATEGORY_KEY_MAP.put(AccountDetailDashboardFragment.class.getName(),
|
||||
CategoryKey.CATEGORY_ACCOUNT_DETAIL);
|
||||
|
@@ -35,7 +35,6 @@ import android.os.UserManager;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
|
||||
import android.support.v7.preference.Preference.OnPreferenceClickListener;
|
||||
import android.support.v7.preference.PreferenceGroup;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
@@ -921,49 +920,4 @@ public class FingerprintSettings extends SubSettings {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated in favor of new SecuritySettings.
|
||||
*/
|
||||
@Deprecated
|
||||
public static Preference getFingerprintPreferenceForUser(Context context, final int userId) {
|
||||
final FingerprintManager fpm = Utils.getFingerprintManagerOrNull(context);
|
||||
if (fpm == null || !fpm.isHardwareDetected()) {
|
||||
Log.v(TAG, "No fingerprint hardware detected!!");
|
||||
return null;
|
||||
}
|
||||
Preference fingerprintPreference = new Preference(context);
|
||||
fingerprintPreference.setKey(KEY_FINGERPRINT_SETTINGS);
|
||||
fingerprintPreference.setTitle(R.string.security_settings_fingerprint_preference_title);
|
||||
final List<Fingerprint> items = fpm.getEnrolledFingerprints(userId);
|
||||
final int fingerprintCount = items != null ? items.size() : 0;
|
||||
final String clazz;
|
||||
if (fingerprintCount > 0) {
|
||||
fingerprintPreference.setSummary(context.getResources().getQuantityString(
|
||||
R.plurals.security_settings_fingerprint_preference_summary,
|
||||
fingerprintCount, fingerprintCount));
|
||||
clazz = FingerprintSettings.class.getName();
|
||||
} else {
|
||||
fingerprintPreference.setSummary(
|
||||
R.string.security_settings_fingerprint_preference_summary_none);
|
||||
clazz = FingerprintEnrollIntroduction.class.getName();
|
||||
}
|
||||
fingerprintPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
final Context context = preference.getContext();
|
||||
final UserManager userManager = UserManager.get(context);
|
||||
if (Utils.startQuietModeDialogIfNecessary(context, userManager,
|
||||
userId)) {
|
||||
return false;
|
||||
}
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.android.settings", clazz);
|
||||
intent.putExtra(Intent.EXTRA_USER_ID, userId);
|
||||
context.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return fingerprintPreference;
|
||||
}
|
||||
}
|
||||
|
@@ -54,17 +54,6 @@ public class ManagedLockPasswordProvider {
|
||||
*/
|
||||
CharSequence getPickerOptionTitle(boolean forFingerprint) { return ""; }
|
||||
|
||||
/**
|
||||
* Gets resource id of the lock screen preference that should be displayed in security settings
|
||||
* if the current password quality is set to
|
||||
* {@link android.app.admin.DevicePolicyManager#PASSWORD_QUALITY_MANAGED}.
|
||||
* @param forProfile Whether the settings are shown for a user profile rather than a user.
|
||||
*/
|
||||
public int getResIdForLockUnlockScreen(boolean forProfile) {
|
||||
return forProfile ? R.xml.security_settings_password_profile
|
||||
: R.xml.security_settings_password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates intent that should be launched when user chooses managed password in the lock
|
||||
* settings picker.
|
||||
|
@@ -21,7 +21,6 @@ import android.support.annotation.VisibleForTesting;
|
||||
import com.android.settings.DateTimeSettings;
|
||||
import com.android.settings.DisplaySettings;
|
||||
import com.android.settings.LegalSettings;
|
||||
import com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment;
|
||||
import com.android.settings.accessibility.AccessibilitySettings;
|
||||
import com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment;
|
||||
import com.android.settings.accessibility.MagnificationPreferenceFragment;
|
||||
@@ -42,6 +41,7 @@ import com.android.settings.development.DevelopmentSettingsDashboardFragment;
|
||||
import com.android.settings.deviceinfo.DeviceInfoSettings;
|
||||
import com.android.settings.deviceinfo.StorageDashboardFragment;
|
||||
import com.android.settings.deviceinfo.StorageSettings;
|
||||
import com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment;
|
||||
import com.android.settings.display.AmbientDisplaySettings;
|
||||
import com.android.settings.display.NightDisplaySettings;
|
||||
import com.android.settings.display.ScreenZoomSettings;
|
||||
@@ -75,7 +75,7 @@ import com.android.settings.print.PrintSettingsFragment;
|
||||
import com.android.settings.security.EncryptionAndCredential;
|
||||
import com.android.settings.security.LockscreenDashboardFragment;
|
||||
import com.android.settings.security.ScreenPinningSettings;
|
||||
import com.android.settings.security.SecuritySettingsV2;
|
||||
import com.android.settings.security.SecuritySettings;
|
||||
import com.android.settings.security.screenlock.ScreenLockSettings;
|
||||
import com.android.settings.sim.SimSettings;
|
||||
import com.android.settings.support.SupportDashboardActivity;
|
||||
@@ -132,7 +132,7 @@ public class SearchIndexableResourcesImpl implements SearchIndexableResources {
|
||||
addIndex(LanguageAndInputSettings.class);
|
||||
addIndex(LocationSettings.class);
|
||||
addIndex(ScanningSettings.class);
|
||||
addIndex(SecuritySettingsV2.class);
|
||||
addIndex(SecuritySettings.class);
|
||||
addIndex(ScreenLockSettings.class);
|
||||
addIndex(EncryptionAndCredential.class);
|
||||
addIndex(ScreenPinningSettings.class);
|
||||
|
@@ -16,8 +16,7 @@
|
||||
|
||||
package com.android.settings.security;
|
||||
|
||||
import static com.android.settings.security
|
||||
.SecuritySettingsV2.SET_OR_CHANGE_LOCK_METHOD_REQUEST_PROFILE;
|
||||
import static com.android.settings.security.SecuritySettings.SET_OR_CHANGE_LOCK_METHOD_REQUEST_PROFILE;
|
||||
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.Context;
|
||||
@@ -37,7 +36,7 @@ public class ChangeProfileScreenLockPreferenceController extends
|
||||
private static final String KEY_UNLOCK_SET_OR_CHANGE_PROFILE = "unlock_set_or_change_profile";
|
||||
|
||||
public ChangeProfileScreenLockPreferenceController(Context context,
|
||||
SecuritySettingsV2 host) {
|
||||
SecuritySettings host) {
|
||||
super(context, host);
|
||||
}
|
||||
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.settings.security;
|
||||
|
||||
import static com.android.settings.security.SecuritySettingsV2.SET_OR_CHANGE_LOCK_METHOD_REQUEST;
|
||||
import static com.android.settings.security.SecuritySettings.SET_OR_CHANGE_LOCK_METHOD_REQUEST;
|
||||
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.Context;
|
||||
@@ -45,7 +45,7 @@ public class ChangeScreenLockPreferenceController extends AbstractPreferenceCont
|
||||
private static final String KEY_UNLOCK_SET_OR_CHANGE = "unlock_set_or_change";
|
||||
|
||||
protected final DevicePolicyManager mDPM;
|
||||
protected final SecuritySettingsV2 mHost;
|
||||
protected final SecuritySettings mHost;
|
||||
protected final UserManager mUm;
|
||||
protected final LockPatternUtils mLockPatternUtils;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ChangeScreenLockPreferenceController extends AbstractPreferenceCont
|
||||
|
||||
protected RestrictedPreference mPreference;
|
||||
|
||||
public ChangeScreenLockPreferenceController(Context context, SecuritySettingsV2 host) {
|
||||
public ChangeScreenLockPreferenceController(Context context, SecuritySettings host) {
|
||||
super(context);
|
||||
mUm = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||
mDPM = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||
|
@@ -16,11 +16,10 @@
|
||||
|
||||
package com.android.settings.security;
|
||||
|
||||
import static com.android.settings.security
|
||||
.SecuritySettingsV2.SET_OR_CHANGE_LOCK_METHOD_REQUEST_PROFILE;
|
||||
import static com.android.settings.security.SecuritySettingsV2.UNIFY_LOCK_CONFIRM_DEVICE_REQUEST;
|
||||
import static com.android.settings.security.SecuritySettingsV2.UNIFY_LOCK_CONFIRM_PROFILE_REQUEST;
|
||||
import static com.android.settings.security.SecuritySettingsV2.UNUNIFY_LOCK_CONFIRM_DEVICE_REQUEST;
|
||||
import static com.android.settings.security.SecuritySettings.SET_OR_CHANGE_LOCK_METHOD_REQUEST_PROFILE;
|
||||
import static com.android.settings.security.SecuritySettings.UNIFY_LOCK_CONFIRM_DEVICE_REQUEST;
|
||||
import static com.android.settings.security.SecuritySettings.UNIFY_LOCK_CONFIRM_PROFILE_REQUEST;
|
||||
import static com.android.settings.security.SecuritySettings.UNUNIFY_LOCK_CONFIRM_DEVICE_REQUEST;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
@@ -53,7 +52,7 @@ public class LockUnificationPreferenceController extends AbstractPreferenceContr
|
||||
private final UserManager mUm;
|
||||
private final LockPatternUtils mLockPatternUtils;
|
||||
private final int mProfileChallengeUserId;
|
||||
private final SecuritySettingsV2 mHost;
|
||||
private final SecuritySettings mHost;
|
||||
|
||||
private RestrictedSwitchPreference mUnifyProfile;
|
||||
|
||||
@@ -67,7 +66,7 @@ public class LockUnificationPreferenceController extends AbstractPreferenceContr
|
||||
mUnifyProfile = (RestrictedSwitchPreference) screen.findPreference(KEY_UNIFICATION);
|
||||
}
|
||||
|
||||
public LockUnificationPreferenceController(Context context, SecuritySettingsV2 host) {
|
||||
public LockUnificationPreferenceController(Context context, SecuritySettings host) {
|
||||
super(context);
|
||||
mHost = host;
|
||||
mUm = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||
@@ -212,7 +211,7 @@ public class LockUnificationPreferenceController extends AbstractPreferenceContr
|
||||
mCurrentProfilePassword);
|
||||
mHost.startFragment(mHost, ChooseLockGeneric.ChooseLockGenericFragment.class.getName(),
|
||||
R.string.lock_settings_picker_title,
|
||||
SecuritySettingsV2.SET_OR_CHANGE_LOCK_METHOD_REQUEST, null);
|
||||
SecuritySettings.SET_OR_CHANGE_LOCK_METHOD_REQUEST, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,26 +17,14 @@
|
||||
package com.android.settings.security;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.security.trustagent.TrustAgentManager;
|
||||
import com.android.settingslib.drawer.DashboardCategory;
|
||||
|
||||
|
||||
/** FeatureProvider for security. */
|
||||
public interface SecurityFeatureProvider {
|
||||
|
||||
default boolean isSecuritySettingsV2Enabled(Context context) {
|
||||
return FeatureFlagUtils.isEnabled(context, FeatureFlags.SECURITY_SETTINGS_V2);
|
||||
}
|
||||
|
||||
/** Update preferences with data from associated tiles. */
|
||||
void updatePreferences(Context context, PreferenceScreen preferenceScreen,
|
||||
DashboardCategory dashboardCategory);
|
||||
|
||||
/** Returns the {@link TrustAgentManager} bound to this {@link SecurityFeatureProvider}. */
|
||||
TrustAgentManager getTrustAgentManager();
|
||||
|
||||
|
@@ -17,28 +17,9 @@
|
||||
package com.android.settings.security;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.IContentProvider;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Pair;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.security.trustagent.TrustAgentManager;
|
||||
import com.android.settingslib.drawer.DashboardCategory;
|
||||
import com.android.settingslib.drawer.Tile;
|
||||
import com.android.settingslib.drawer.TileUtils;
|
||||
import com.android.settingslib.utils.ThreadUtils;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/** Implementation for {@code SecurityFeatureProvider}. */
|
||||
public class SecurityFeatureProviderImpl implements SecurityFeatureProvider {
|
||||
@@ -46,150 +27,6 @@ public class SecurityFeatureProviderImpl implements SecurityFeatureProvider {
|
||||
private TrustAgentManager mTrustAgentManager;
|
||||
private LockPatternUtils mLockPatternUtils;
|
||||
|
||||
@VisibleForTesting
|
||||
static final Drawable DEFAULT_ICON = null;
|
||||
|
||||
@VisibleForTesting
|
||||
static Map<String, Pair<String, Integer>> sIconCache = new TreeMap<>();
|
||||
|
||||
@VisibleForTesting
|
||||
static Map<String, String> sSummaryCache = new TreeMap<>();
|
||||
|
||||
/** Update preferences with data from associated tiles. */
|
||||
public void updatePreferences(final Context context, final PreferenceScreen preferenceScreen,
|
||||
final DashboardCategory dashboardCategory) {
|
||||
if (preferenceScreen == null) {
|
||||
return;
|
||||
}
|
||||
int tilesCount = (dashboardCategory != null) ? dashboardCategory.getTilesCount() : 0;
|
||||
if (tilesCount == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
initPreferences(context, preferenceScreen, dashboardCategory);
|
||||
|
||||
// Fetching the summary and icon from the provider introduces latency, so do this on a
|
||||
// separate thread.
|
||||
ThreadUtils.postOnBackgroundThread(() ->
|
||||
updatePreferencesToRunOnWorkerThread(context, preferenceScreen, dashboardCategory));
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
static void initPreferences(Context context, PreferenceScreen preferenceScreen,
|
||||
DashboardCategory dashboardCategory) {
|
||||
int tilesCount = (dashboardCategory != null) ? dashboardCategory.getTilesCount() : 0;
|
||||
for (int i = 0; i < tilesCount; i++) {
|
||||
Tile tile = dashboardCategory.getTile(i);
|
||||
// If the tile does not have a key or appropriate meta data, skip it.
|
||||
if (TextUtils.isEmpty(tile.key) || (tile.metaData == null)) {
|
||||
continue;
|
||||
}
|
||||
Preference matchingPref = preferenceScreen.findPreference(tile.key);
|
||||
// If the tile does not have a matching preference, skip it.
|
||||
if (matchingPref == null) {
|
||||
continue;
|
||||
}
|
||||
// Either remove an icon by replacing them with nothing, or use the cached one since
|
||||
// there is a delay in fetching the injected icon, and we don't want an inappropriate
|
||||
// icon to be displayed while waiting for the injected icon.
|
||||
final String iconUri =
|
||||
tile.metaData.getString(TileUtils.META_DATA_PREFERENCE_ICON_URI, null);
|
||||
Drawable drawable = DEFAULT_ICON;
|
||||
if ((iconUri != null) && sIconCache.containsKey(iconUri)) {
|
||||
Pair<String, Integer> icon = sIconCache.get(iconUri);
|
||||
try {
|
||||
drawable = context.getPackageManager()
|
||||
.getResourcesForApplication(icon.first /* package name */)
|
||||
.getDrawable(icon.second /* res id */,
|
||||
context.getTheme());
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
// Ignore and just load the default icon.
|
||||
}
|
||||
}
|
||||
matchingPref.setIcon(drawable);
|
||||
// Either reserve room for the summary or load the cached one. This prevents the title
|
||||
// from shifting when the final summary is injected.
|
||||
final String summaryUri =
|
||||
tile.metaData.getString(TileUtils.META_DATA_PREFERENCE_SUMMARY_URI, null);
|
||||
String summary = context.getString(R.string.summary_placeholder);
|
||||
if ((summaryUri != null) && sSummaryCache.containsKey(summaryUri)) {
|
||||
summary = sSummaryCache.get(summaryUri);
|
||||
}
|
||||
matchingPref.setSummary(summary);
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void updatePreferencesToRunOnWorkerThread(Context context, PreferenceScreen preferenceScreen,
|
||||
DashboardCategory dashboardCategory) {
|
||||
|
||||
int tilesCount = (dashboardCategory != null) ? dashboardCategory.getTilesCount() : 0;
|
||||
Map<String, IContentProvider> providerMap = new ArrayMap<>();
|
||||
for (int i = 0; i < tilesCount; i++) {
|
||||
Tile tile = dashboardCategory.getTile(i);
|
||||
// If the tile does not have a key or appropriate meta data, skip it.
|
||||
if (TextUtils.isEmpty(tile.key) || (tile.metaData == null)) {
|
||||
continue;
|
||||
}
|
||||
Preference matchingPref = preferenceScreen.findPreference(tile.key);
|
||||
// If the tile does not have a matching preference, skip it.
|
||||
if (matchingPref == null) {
|
||||
continue;
|
||||
}
|
||||
// Check if the tile has content providers for dynamically updatable content.
|
||||
final String iconUri =
|
||||
tile.metaData.getString(TileUtils.META_DATA_PREFERENCE_ICON_URI, null);
|
||||
final String summaryUri =
|
||||
tile.metaData.getString(TileUtils.META_DATA_PREFERENCE_SUMMARY_URI, null);
|
||||
if (!TextUtils.isEmpty(iconUri)) {
|
||||
String packageName = null;
|
||||
if (tile.intent != null) {
|
||||
Intent intent = tile.intent;
|
||||
if (!TextUtils.isEmpty(intent.getPackage())) {
|
||||
packageName = intent.getPackage();
|
||||
} else if (intent.getComponent() != null) {
|
||||
packageName = intent.getComponent().getPackageName();
|
||||
}
|
||||
}
|
||||
Pair<String, Integer> icon =
|
||||
TileUtils.getIconFromUri(context, packageName, iconUri, providerMap);
|
||||
if (icon != null) {
|
||||
sIconCache.put(iconUri, icon);
|
||||
// Icon is only returned if the icon belongs to Settings or the target app.
|
||||
// setIcon must be called on the UI thread.
|
||||
ThreadUtils.postOnMainThread(() -> {
|
||||
try {
|
||||
matchingPref.setIcon(context.getPackageManager()
|
||||
.getResourcesForApplication(icon.first /* package name */)
|
||||
.getDrawable(icon.second /* res id */,
|
||||
context.getTheme()));
|
||||
} catch (PackageManager.NameNotFoundException
|
||||
| Resources.NotFoundException e) {
|
||||
// Intentionally ignored. If icon resources cannot be found, do not
|
||||
// update.
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (!TextUtils.isEmpty(summaryUri)) {
|
||||
String summary = TileUtils.getTextFromUri(context, summaryUri, providerMap,
|
||||
TileUtils.META_DATA_PREFERENCE_SUMMARY);
|
||||
sSummaryCache.put(summaryUri, summary);
|
||||
// setSummary must be called on UI thread.
|
||||
ThreadUtils.postOnMainThread(() -> {
|
||||
// Only update the summary if it has actually changed.
|
||||
if (summary == null) {
|
||||
if (matchingPref.getSummary() != null) {
|
||||
matchingPref.setSummary(summary);
|
||||
}
|
||||
} else if (!summary.equals(matchingPref.getSummary())) {
|
||||
matchingPref.setSummary(summary);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrustAgentManager getTrustAgentManager() {
|
||||
if (mTrustAgentManager == null) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,188 +0,0 @@
|
||||
package com.android.settings.security;
|
||||
|
||||
import static com.android.settings.security.EncryptionStatusPreferenceController
|
||||
.PREF_KEY_ENCRYPTION_SECURITY_PAGE;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.provider.SearchIndexableResource;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.dashboard.SummaryLoader;
|
||||
import com.android.settings.enterprise.EnterprisePrivacyPreferenceController;
|
||||
import com.android.settings.enterprise.ManageDeviceAdminPreferenceController;
|
||||
import com.android.settings.fingerprint.FingerprintProfileStatusPreferenceController;
|
||||
import com.android.settings.fingerprint.FingerprintStatusPreferenceController;
|
||||
import com.android.settings.location.LocationPreferenceController;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settings.security.screenlock.LockScreenPreferenceController;
|
||||
import com.android.settings.security.trustagent.ManageTrustAgentsPreferenceController;
|
||||
import com.android.settings.security.trustagent.TrustAgentListPreferenceController;
|
||||
import com.android.settings.widget.PreferenceCategoryController;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SecuritySettingsV2 extends DashboardFragment {
|
||||
|
||||
private static final String TAG = "SecuritySettingsV2";
|
||||
|
||||
public static final int SET_OR_CHANGE_LOCK_METHOD_REQUEST = 123;
|
||||
public static final int CHANGE_TRUST_AGENT_SETTINGS = 126;
|
||||
public static final int SET_OR_CHANGE_LOCK_METHOD_REQUEST_PROFILE = 127;
|
||||
public static final int UNIFY_LOCK_CONFIRM_DEVICE_REQUEST = 128;
|
||||
public static final int UNIFY_LOCK_CONFIRM_PROFILE_REQUEST = 129;
|
||||
public static final int UNUNIFY_LOCK_CONFIRM_DEVICE_REQUEST = 130;
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.SECURITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.security_settings_v2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLogTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHelpResource() {
|
||||
return R.string.help_url_security;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
|
||||
return buildPreferenceControllers(context, getLifecycle(), this /* host*/);
|
||||
}
|
||||
|
||||
/**
|
||||
* see confirmPatternThenDisableAndClear
|
||||
*/
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (getPreferenceController(TrustAgentListPreferenceController.class)
|
||||
.handleActivityResult(requestCode, resultCode)) {
|
||||
return;
|
||||
}
|
||||
if (getPreferenceController(LockUnificationPreferenceController.class)
|
||||
.handleActivityResult(requestCode, resultCode, data)) {
|
||||
return;
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
void launchConfirmDeviceLockForUnification() {
|
||||
getPreferenceController(LockUnificationPreferenceController.class)
|
||||
.launchConfirmDeviceLockForUnification();
|
||||
}
|
||||
|
||||
void unifyUncompliantLocks() {
|
||||
getPreferenceController(LockUnificationPreferenceController.class).unifyUncompliantLocks();
|
||||
}
|
||||
|
||||
void updateUnificationPreference() {
|
||||
getPreferenceController(LockUnificationPreferenceController.class).updateState(null);
|
||||
}
|
||||
|
||||
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
|
||||
Lifecycle lifecycle, SecuritySettingsV2 host) {
|
||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
controllers.add(new LocationPreferenceController(context, lifecycle));
|
||||
controllers.add(new ManageDeviceAdminPreferenceController(context));
|
||||
controllers.add(new EnterprisePrivacyPreferenceController(context));
|
||||
controllers.add(new ManageTrustAgentsPreferenceController(context));
|
||||
controllers.add(new ScreenPinningPreferenceController(context));
|
||||
controllers.add(new SimLockPreferenceController(context));
|
||||
controllers.add(new ShowPasswordPreferenceController(context));
|
||||
controllers.add(new FingerprintStatusPreferenceController(context));
|
||||
controllers.add(new EncryptionStatusPreferenceController(context,
|
||||
PREF_KEY_ENCRYPTION_SECURITY_PAGE));
|
||||
controllers.add(new TrustAgentListPreferenceController(context, host, lifecycle));
|
||||
controllers.add(new LockScreenPreferenceController(context, lifecycle));
|
||||
controllers.add(new ChangeScreenLockPreferenceController(context, host));
|
||||
|
||||
final List<AbstractPreferenceController> profileSecurityControllers = new ArrayList<>();
|
||||
profileSecurityControllers.add(new ChangeProfileScreenLockPreferenceController(
|
||||
context, host));
|
||||
profileSecurityControllers.add(new LockUnificationPreferenceController(context, host));
|
||||
profileSecurityControllers.add(new VisiblePatternProfilePreferenceController(
|
||||
context, lifecycle));
|
||||
profileSecurityControllers.add(new FingerprintProfileStatusPreferenceController(context));
|
||||
controllers.add(new PreferenceCategoryController(context, "security_category_profile",
|
||||
profileSecurityControllers));
|
||||
controllers.addAll(profileSecurityControllers);
|
||||
|
||||
return controllers;
|
||||
}
|
||||
|
||||
/**
|
||||
* For Search. Please keep it in sync when updating "createPreferenceHierarchy()"
|
||||
*/
|
||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider() {
|
||||
|
||||
@Override
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(
|
||||
Context context, boolean enabled) {
|
||||
final List<SearchIndexableResource> index = new ArrayList<>();
|
||||
// Append the rest of the settings
|
||||
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||
sir.xmlResId = R.xml.security_settings_v2;
|
||||
index.add(sir);
|
||||
return index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractPreferenceController> getPreferenceControllers(Context
|
||||
context) {
|
||||
return buildPreferenceControllers(context, null /* lifecycle */,
|
||||
null /* host*/);
|
||||
}
|
||||
};
|
||||
|
||||
static class SummaryProvider implements SummaryLoader.SummaryProvider {
|
||||
|
||||
private final Context mContext;
|
||||
private final SummaryLoader mSummaryLoader;
|
||||
|
||||
public SummaryProvider(Context context, SummaryLoader summaryLoader) {
|
||||
mContext = context;
|
||||
mSummaryLoader = summaryLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setListening(boolean listening) {
|
||||
if (listening) {
|
||||
final FingerprintManager fpm =
|
||||
Utils.getFingerprintManagerOrNull(mContext);
|
||||
if (fpm != null && fpm.isHardwareDetected()) {
|
||||
mSummaryLoader.setSummary(this,
|
||||
mContext.getString(R.string.security_dashboard_summary));
|
||||
} else {
|
||||
mSummaryLoader.setSummary(this, mContext.getString(
|
||||
R.string.security_dashboard_summary_no_fingerprint));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY =
|
||||
new SummaryLoader.SummaryProviderFactory() {
|
||||
@Override
|
||||
public SummaryLoader.SummaryProvider createSummaryProvider(Activity activity,
|
||||
SummaryLoader summaryLoader) {
|
||||
return new SummaryProvider(activity, summaryLoader);
|
||||
}
|
||||
};
|
||||
}
|
@@ -40,7 +40,7 @@ public class UnificationConfirmationDialog extends InstrumentedDialogFragment {
|
||||
return dialog;
|
||||
}
|
||||
|
||||
public void show(SecuritySettingsV2 host) {
|
||||
public void show(SecuritySettings host) {
|
||||
final FragmentManager manager = host.getChildFragmentManager();
|
||||
if (manager.findFragmentByTag(TAG_UNIFICATION_DIALOG) == null) {
|
||||
// Prevent opening multiple dialogs if tapped on button quickly
|
||||
@@ -50,7 +50,7 @@ public class UnificationConfirmationDialog extends InstrumentedDialogFragment {
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final SecuritySettingsV2 parentFragment = ((SecuritySettingsV2) getParentFragment());
|
||||
final SecuritySettings parentFragment = ((SecuritySettings) getParentFragment());
|
||||
final boolean compliant = getArguments().getBoolean(EXTRA_COMPLIANT);
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
.setTitle(R.string.lock_settings_profile_unification_dialog_title)
|
||||
@@ -75,7 +75,7 @@ public class UnificationConfirmationDialog extends InstrumentedDialogFragment {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
((SecuritySettingsV2) getParentFragment()).updateUnificationPreference();
|
||||
((SecuritySettings) getParentFragment()).updateUnificationPreference();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.settings.security.trustagent;
|
||||
|
||||
import static com.android.settings.security.SecuritySettingsV2.CHANGE_TRUST_AGENT_SETTINGS;
|
||||
import static com.android.settings.security.SecuritySettings.CHANGE_TRUST_AGENT_SETTINGS;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
@@ -35,7 +35,7 @@ import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.password.ChooseLockSettingsHelper;
|
||||
import com.android.settings.security.SecurityFeatureProvider;
|
||||
import com.android.settings.security.SecuritySettingsV2;
|
||||
import com.android.settings.security.SecuritySettings;
|
||||
import com.android.settingslib.RestrictedPreference;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
@@ -59,12 +59,12 @@ public class TrustAgentListPreferenceController extends AbstractPreferenceContro
|
||||
|
||||
private final LockPatternUtils mLockPatternUtils;
|
||||
private final TrustAgentManager mTrustAgentManager;
|
||||
private final SecuritySettingsV2 mHost;
|
||||
private final SecuritySettings mHost;
|
||||
|
||||
private Intent mTrustAgentClickIntent;
|
||||
private PreferenceCategory mSecurityCategory;
|
||||
|
||||
public TrustAgentListPreferenceController(Context context, SecuritySettingsV2 host,
|
||||
public TrustAgentListPreferenceController(Context context, SecuritySettings host,
|
||||
Lifecycle lifecycle) {
|
||||
super(context);
|
||||
final SecurityFeatureProvider provider = FeatureFactory.getFactory(context)
|
||||
|
@@ -1,3 +1,2 @@
|
||||
com.android.settings.display.ScreenZoomPreferenceFragmentForSetupWizard
|
||||
com.android.settings.search.indexing.FakeSettingsFragment
|
||||
com.android.settings.security.SecuritySettings
|
||||
com.android.settings.search.indexing.FakeSettingsFragment
|
@@ -19,7 +19,6 @@ import com.android.settings.search.SearchFeatureProvider;
|
||||
import com.android.settings.search.SearchFeatureProviderImpl;
|
||||
import com.android.settings.search.XmlParserUtils;
|
||||
import com.android.settings.security.SecuritySettings;
|
||||
import com.android.settings.security.SecuritySettingsV2;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
|
||||
@@ -32,7 +31,6 @@ import org.robolectric.annotation.Config;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -47,25 +45,13 @@ public class XmlControllerAttributeTest {
|
||||
// List of classes that are too hard to mock in order to retrieve xml information.
|
||||
private final List<Class> illegalClasses = new ArrayList<>(
|
||||
Arrays.asList(
|
||||
SecuritySettings.class,
|
||||
SecuritySettingsV2.class
|
||||
SecuritySettings.class
|
||||
));
|
||||
|
||||
// List of XML that could be retrieved from the illegalClasses list.
|
||||
private final List<Integer> whitelistXml = new ArrayList<>(
|
||||
Arrays.asList(
|
||||
R.xml.security_settings_misc,
|
||||
R.xml.security_settings_lockscreen_profile,
|
||||
R.xml.security_settings_lockscreen,
|
||||
R.xml.security_settings_chooser,
|
||||
R.xml.security_settings_pattern_profile,
|
||||
R.xml.security_settings_pin_profile,
|
||||
R.xml.security_settings_password_profile,
|
||||
R.xml.security_settings_pattern,
|
||||
R.xml.security_settings_pin,
|
||||
R.xml.security_settings_password,
|
||||
R.xml.security_settings,
|
||||
R.xml.security_settings_status
|
||||
R.xml.security_dashboard_settings
|
||||
));
|
||||
|
||||
private static final String NO_VALID_CONSTRUCTOR_ERROR =
|
||||
|
@@ -55,7 +55,7 @@ public class LockUnificationPreferenceControllerTest {
|
||||
@Mock
|
||||
private PreferenceScreen mScreen;
|
||||
@Mock
|
||||
private SecuritySettingsV2 mHost;
|
||||
private SecuritySettings mHost;
|
||||
|
||||
private FakeFeatureFactory mFeatureFactory;
|
||||
private Context mContext;
|
||||
|
@@ -16,192 +16,51 @@
|
||||
|
||||
package com.android.settings.security;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyInt;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.security.trustagent.TrustAgentManager;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.testutils.shadow.ShadowTileUtils;
|
||||
import com.android.settingslib.drawer.DashboardCategory;
|
||||
import com.android.settingslib.drawer.Tile;
|
||||
import com.android.settingslib.drawer.TileUtils;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.shadows.ShadowLooper;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
public class SecurityFeatureProviderImplTest {
|
||||
|
||||
private static final String MOCK_KEY = "key";
|
||||
private static final String MOCK_SUMMARY = "summary";
|
||||
private static final String URI_GET_SUMMARY = "content://package/text/summary";
|
||||
private static final String URI_GET_ICON = "content://package/icon/my_icon";
|
||||
|
||||
@Mock
|
||||
private Drawable mMockDrawable;
|
||||
@Mock
|
||||
private Context mContext;
|
||||
@Mock
|
||||
private PackageManager mPackageManager;
|
||||
@Mock
|
||||
private Resources mResources;
|
||||
|
||||
private SecurityFeatureProviderImpl mImpl;
|
||||
|
||||
@Before
|
||||
public void setUp() throws PackageManager.NameNotFoundException {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = spy(RuntimeEnvironment.application);
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mImpl = new SecurityFeatureProviderImpl();
|
||||
when(mContext.getPackageManager()).thenReturn(mPackageManager);
|
||||
when(mPackageManager.getResourcesForApplication(anyString())).thenReturn(mResources);
|
||||
when(mResources.getDrawable(anyInt(), any())).thenReturn(mMockDrawable);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateTilesData_shouldNotProcessEmptyScreenOrTiles() {
|
||||
mImpl.updatePreferencesToRunOnWorkerThread(mContext, null, null);
|
||||
ShadowLooper.runUiThreadTasks();
|
||||
mImpl.updatePreferencesToRunOnWorkerThread(
|
||||
mContext, new PreferenceScreen(mContext, null), null);
|
||||
ShadowLooper.runUiThreadTasks();
|
||||
verifyNoMoreInteractions(mPackageManager);
|
||||
public void getTrustAgentManager_shouldReturnCache() {
|
||||
final TrustAgentManager m1 = mImpl.getTrustAgentManager();
|
||||
final TrustAgentManager m2 = mImpl.getTrustAgentManager();
|
||||
|
||||
assertThat(m1).isSameAs(m2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateTilesData_shouldNotProcessNonMatchingPreference() {
|
||||
DashboardCategory dashboardCategory = new DashboardCategory();
|
||||
dashboardCategory.addTile(new Tile());
|
||||
mImpl.updatePreferencesToRunOnWorkerThread(
|
||||
mContext, getPreferenceScreen(), dashboardCategory);
|
||||
ShadowLooper.runUiThreadTasks();
|
||||
verifyNoMoreInteractions(mPackageManager);
|
||||
public void getLockPatternUtils_shouldReturnCache() {
|
||||
final LockPatternUtils l1 = mImpl.getLockPatternUtils(mContext);
|
||||
final LockPatternUtils l2 = mImpl.getLockPatternUtils(mContext);
|
||||
|
||||
assertThat(l1).isSameAs(l2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateTilesData_shouldNotProcessMatchingPreferenceWithNoData() {
|
||||
mImpl.updatePreferencesToRunOnWorkerThread(
|
||||
mContext, getPreferenceScreen(), getDashboardCategory());
|
||||
ShadowLooper.runUiThreadTasks();
|
||||
verifyNoMoreInteractions(mPackageManager);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(shadows = {
|
||||
ShadowTileUtils.class,
|
||||
})
|
||||
public void updateTilesData_shouldUpdateMatchingPreference() {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(TileUtils.META_DATA_PREFERENCE_ICON_URI, URI_GET_ICON);
|
||||
bundle.putString(TileUtils.META_DATA_PREFERENCE_SUMMARY_URI, URI_GET_SUMMARY);
|
||||
|
||||
PreferenceScreen screen = getPreferenceScreen();
|
||||
DashboardCategory dashboardCategory = getDashboardCategory();
|
||||
dashboardCategory.getTile(0).intent = new Intent().setPackage("package");
|
||||
dashboardCategory.getTile(0).metaData = bundle;
|
||||
|
||||
mImpl.updatePreferencesToRunOnWorkerThread(mContext, screen, dashboardCategory);
|
||||
ShadowLooper.runUiThreadTasks();
|
||||
verify(screen.findPreference(MOCK_KEY)).setIcon(mMockDrawable);
|
||||
verify(screen.findPreference(MOCK_KEY)).setSummary(MOCK_SUMMARY);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(shadows = {
|
||||
ShadowTileUtils.class,
|
||||
})
|
||||
public void updateTilesData_shouldNotUpdateAlreadyUpdatedPreference() {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(TileUtils.META_DATA_PREFERENCE_ICON_URI, URI_GET_ICON);
|
||||
bundle.putString(TileUtils.META_DATA_PREFERENCE_SUMMARY_URI, URI_GET_SUMMARY);
|
||||
|
||||
PreferenceScreen screen = getPreferenceScreen();
|
||||
when(screen.findPreference(MOCK_KEY).getSummary()).thenReturn(MOCK_SUMMARY);
|
||||
when(screen.findPreference(MOCK_KEY).getIcon()).thenReturn(mMockDrawable);
|
||||
|
||||
DashboardCategory dashboardCategory = getDashboardCategory();
|
||||
dashboardCategory.getTile(0).intent = new Intent().setPackage("package");
|
||||
dashboardCategory.getTile(0).metaData = bundle;
|
||||
|
||||
mImpl.updatePreferencesToRunOnWorkerThread(mContext, screen, dashboardCategory);
|
||||
ShadowLooper.runUiThreadTasks();
|
||||
verify(screen.findPreference(MOCK_KEY), never()).setSummary(anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void initPreferences_shouldLoadDefaults() {
|
||||
PreferenceScreen screen = getPreferenceScreen();
|
||||
DashboardCategory dashboardCategory = getDashboardCategory();
|
||||
dashboardCategory.getTile(0).metaData = new Bundle();
|
||||
|
||||
mImpl.initPreferences(mContext, screen, dashboardCategory);
|
||||
verify(screen.findPreference(MOCK_KEY)).setIcon(SecurityFeatureProviderImpl.DEFAULT_ICON);
|
||||
verify(screen.findPreference(MOCK_KEY))
|
||||
.setSummary(mContext.getString(R.string.summary_placeholder));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(shadows = {
|
||||
ShadowTileUtils.class,
|
||||
})
|
||||
public void initPreferences_shouldLoadCached() {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(TileUtils.META_DATA_PREFERENCE_ICON_URI, URI_GET_ICON);
|
||||
bundle.putString(TileUtils.META_DATA_PREFERENCE_SUMMARY_URI, URI_GET_SUMMARY);
|
||||
|
||||
PreferenceScreen screen = getPreferenceScreen();
|
||||
DashboardCategory dashboardCategory = getDashboardCategory();
|
||||
dashboardCategory.getTile(0).metaData = bundle;
|
||||
|
||||
SecurityFeatureProviderImpl.sIconCache.put(
|
||||
URI_GET_ICON,
|
||||
ShadowTileUtils.getIconFromUri(null, null, null, null));
|
||||
SecurityFeatureProviderImpl.sSummaryCache.put(
|
||||
URI_GET_SUMMARY,
|
||||
MOCK_SUMMARY);
|
||||
|
||||
mImpl.initPreferences(mContext, screen, dashboardCategory);
|
||||
verify(screen.findPreference(MOCK_KEY)).setIcon(mMockDrawable);
|
||||
verify(screen.findPreference(MOCK_KEY)).setSummary(MOCK_SUMMARY);
|
||||
}
|
||||
|
||||
private PreferenceScreen getPreferenceScreen() {
|
||||
final PreferenceScreen screen = mock(PreferenceScreen.class);
|
||||
final Preference pref = mock(Preference.class);
|
||||
when(screen.findPreference(MOCK_KEY)).thenReturn(pref);
|
||||
when(pref.getKey()).thenReturn(MOCK_KEY);
|
||||
return screen;
|
||||
}
|
||||
|
||||
private static DashboardCategory getDashboardCategory() {
|
||||
DashboardCategory dashboardCategory = new DashboardCategory();
|
||||
Tile tile = new Tile();
|
||||
tile.key = MOCK_KEY;
|
||||
dashboardCategory.addTile(tile);
|
||||
return dashboardCategory;
|
||||
}
|
||||
}
|
||||
|
@@ -16,34 +16,18 @@
|
||||
|
||||
package com.android.settings.security;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Matchers.anyInt;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.reset;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.os.UserManager.EnforcingUser;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.dashboard.SummaryLoader;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.testutils.XmlTestUtils;
|
||||
import com.android.settings.testutils.shadow.ShadowLockPatternUtils;
|
||||
import com.android.settings.testutils.shadow.ShadowUserManager;
|
||||
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
||||
import com.android.settingslib.RestrictedSwitchPreference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -51,123 +35,65 @@ import org.junit.runner.RunWith;
|
||||
import org.mockito.Answers;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.shadows.ShadowApplication;
|
||||
import org.robolectric.util.ReflectionHelpers;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
|
||||
shadows = {
|
||||
ShadowLockPatternUtils.class,
|
||||
ShadowUserManager.class,
|
||||
})
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
public class SecuritySettingsTest {
|
||||
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
private Context mContext;
|
||||
@Mock
|
||||
private SummaryLoader mSummaryLoader;
|
||||
|
||||
@Mock
|
||||
private FingerprintManager mFingerprintManager;
|
||||
private SecuritySettings.SummaryProvider mSummaryProvider;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
FakeFeatureFactory.setupForTest();
|
||||
when(mContext.getSystemService(Context.FINGERPRINT_SERVICE))
|
||||
.thenReturn(mFingerprintManager);
|
||||
|
||||
mSummaryProvider = new SecuritySettings.SummaryProvider(mContext, mSummaryLoader);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitTrustAgentPreference_secure_shouldSetSummaryToNumberOfTrustAgent() {
|
||||
final Preference preference = mock(Preference.class);
|
||||
final PreferenceScreen screen = mock(PreferenceScreen.class);
|
||||
when(screen.findPreference(SecuritySettings.KEY_MANAGE_TRUST_AGENTS))
|
||||
.thenReturn(preference);
|
||||
final LockPatternUtils utils = mock(LockPatternUtils.class);
|
||||
when(utils.isSecure(anyInt())).thenReturn(true);
|
||||
final Context context = ShadowApplication.getInstance().getApplicationContext();
|
||||
final Activity activity = mock(Activity.class);
|
||||
when(activity.getResources()).thenReturn(context.getResources());
|
||||
final SecuritySettings securitySettings = spy(new SecuritySettings());
|
||||
when(securitySettings.getActivity()).thenReturn(activity);
|
||||
public void testSummaryProvider_notListening() {
|
||||
mSummaryProvider.setListening(false);
|
||||
|
||||
ReflectionHelpers.setField(securitySettings, "mLockPatternUtils", utils);
|
||||
|
||||
securitySettings.initTrustAgentPreference(screen, 0);
|
||||
verify(preference).setSummary(R.string.manage_trust_agents_summary);
|
||||
|
||||
securitySettings.initTrustAgentPreference(screen, 2);
|
||||
verify(preference).setSummary(context.getResources().getQuantityString(
|
||||
R.plurals.manage_trust_agents_summary_on, 2, 2));
|
||||
verifyNoMoreInteractions(mSummaryLoader);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonIndexableKeys_existInXmlLayout() {
|
||||
final Context context = spy(RuntimeEnvironment.application);
|
||||
UserManager manager = mock(UserManager.class);
|
||||
when(manager.isAdminUser()).thenReturn(false);
|
||||
doReturn(manager).when(context).getSystemService(Context.USER_SERVICE);
|
||||
final List<String> niks = SecuritySettings.SEARCH_INDEX_DATA_PROVIDER
|
||||
.getNonIndexableKeys(context);
|
||||
public void testSummaryProvider_hasFingerPrint_hasStaticSummary() {
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
|
||||
.thenReturn(true);
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
|
||||
|
||||
final List<String> keys = XmlTestUtils.getKeysFromPreferenceXml(context,
|
||||
R.xml.security_settings_misc);
|
||||
keys.addAll(XmlTestUtils.getKeysFromPreferenceXml(context,
|
||||
R.xml.location_settings));
|
||||
keys.addAll(XmlTestUtils.getKeysFromPreferenceXml(context,
|
||||
R.xml.encryption_and_credential));
|
||||
mSummaryProvider.setListening(true);
|
||||
|
||||
assertThat(keys).containsAllIn(niks);
|
||||
verify(mContext).getString(R.string.security_dashboard_summary);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnifyLockRestriction() {
|
||||
// Set up instance under test.
|
||||
final Context context = spy(RuntimeEnvironment.application);
|
||||
final SecuritySettings securitySettings = spy(new SecuritySettings());
|
||||
when(securitySettings.getContext()).thenReturn(context);
|
||||
public void testSummaryProvider_noFpFeature_shouldSetSummaryWithNoFingerprint() {
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
|
||||
.thenReturn(false);
|
||||
|
||||
final int userId = 123;
|
||||
ReflectionHelpers.setField(securitySettings, "mProfileChallengeUserId", userId);
|
||||
mSummaryProvider.setListening(true);
|
||||
|
||||
final LockPatternUtils utils = mock(LockPatternUtils.class);
|
||||
when(utils.isSeparateProfileChallengeEnabled(userId)).thenReturn(true);
|
||||
ReflectionHelpers.setField(securitySettings, "mLockPatternUtils", utils);
|
||||
verify(mContext).getString(R.string.security_dashboard_summary_no_fingerprint);
|
||||
}
|
||||
|
||||
final RestrictedSwitchPreference unifyProfile = mock(RestrictedSwitchPreference.class);
|
||||
ReflectionHelpers.setField(securitySettings, "mUnifyProfile", unifyProfile);
|
||||
@Test
|
||||
public void testSummaryProvider_noFpHardware_shouldSetSummaryWithNoFingerprint() {
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
|
||||
.thenReturn(true);
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
|
||||
|
||||
// Pretend that no admins enforce the restriction.
|
||||
ShadowUserManager.getShadow().setUserRestrictionSources(
|
||||
UserManager.DISALLOW_UNIFIED_PASSWORD,
|
||||
UserHandle.of(userId),
|
||||
Collections.emptyList());
|
||||
mSummaryProvider.setListening(true);
|
||||
|
||||
securitySettings.updateUnificationPreference();
|
||||
|
||||
verify(unifyProfile).setDisabledByAdmin(null);
|
||||
|
||||
reset(unifyProfile);
|
||||
|
||||
// Pretend that the restriction is enforced by several admins. Having just one would
|
||||
// require more mocking of implementation details.
|
||||
final EnforcingUser enforcer1 = new EnforcingUser(
|
||||
userId, UserManager.RESTRICTION_SOURCE_PROFILE_OWNER);
|
||||
final EnforcingUser enforcer2 = new EnforcingUser(
|
||||
UserHandle.USER_SYSTEM, UserManager.RESTRICTION_SOURCE_DEVICE_OWNER);
|
||||
ShadowUserManager.getShadow().setUserRestrictionSources(
|
||||
UserManager.DISALLOW_UNIFIED_PASSWORD,
|
||||
UserHandle.of(userId),
|
||||
Arrays.asList(enforcer1, enforcer2));
|
||||
|
||||
securitySettings.updateUnificationPreference();
|
||||
|
||||
verify(unifyProfile).setDisabledByAdmin(EnforcedAdmin.MULTIPLE_ENFORCED_ADMIN);
|
||||
verify(mContext).getString(R.string.security_dashboard_summary_no_fingerprint);
|
||||
}
|
||||
}
|
||||
|
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.security;
|
||||
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.dashboard.SummaryLoader;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Answers;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
public class SecuritySettingsV2Test {
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
private Context mContext;
|
||||
@Mock
|
||||
private SummaryLoader mSummaryLoader;
|
||||
@Mock
|
||||
private FingerprintManager mFingerprintManager;
|
||||
private SecuritySettings.SummaryProvider mSummaryProvider;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
when(mContext.getSystemService(Context.FINGERPRINT_SERVICE))
|
||||
.thenReturn(mFingerprintManager);
|
||||
|
||||
mSummaryProvider = new SecuritySettings.SummaryProvider(mContext, mSummaryLoader);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSummaryProvider_notListening() {
|
||||
mSummaryProvider.setListening(false);
|
||||
|
||||
verifyNoMoreInteractions(mSummaryLoader);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSummaryProvider_hasFingerPrint_hasStaticSummary() {
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
|
||||
.thenReturn(true);
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
|
||||
|
||||
mSummaryProvider.setListening(true);
|
||||
|
||||
verify(mContext).getString(R.string.security_dashboard_summary);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSummaryProvider_noFpFeature_shouldSetSummaryWithNoFingerprint() {
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
|
||||
.thenReturn(false);
|
||||
|
||||
mSummaryProvider.setListening(true);
|
||||
|
||||
verify(mContext).getString(R.string.security_dashboard_summary_no_fingerprint);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSummaryProvider_noFpHardware_shouldSetSummaryWithNoFingerprint() {
|
||||
when(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
|
||||
.thenReturn(true);
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
|
||||
|
||||
mSummaryProvider.setListening(true);
|
||||
|
||||
verify(mContext).getString(R.string.security_dashboard_summary_no_fingerprint);
|
||||
}
|
||||
}
|
@@ -40,7 +40,7 @@ import android.support.v7.preference.PreferenceScreen;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settings.security.SecuritySettingsV2;
|
||||
import com.android.settings.security.SecuritySettings;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
@@ -69,7 +69,7 @@ public class TrustAgentListPreferenceControllerTest {
|
||||
@Mock
|
||||
private PreferenceCategory mCategory;
|
||||
@Mock
|
||||
private SecuritySettingsV2 mFragment;
|
||||
private SecuritySettings mFragment;
|
||||
|
||||
private Lifecycle mLifecycle;
|
||||
private LifecycleOwner mLifecycleOwner;
|
||||
|
@@ -66,7 +66,7 @@ public class SecuritySettingsLaunchTest {
|
||||
public void launchSecuritySettings() throws Exception {
|
||||
// Launch Settings
|
||||
SettingsHelper.launchSettingsPage(
|
||||
InstrumentationRegistry.getContext(), Settings.ACTION_SECURITY_SETTINGS);
|
||||
InstrumentationRegistry.getTargetContext(), Settings.ACTION_SECURITY_SETTINGS);
|
||||
mHelper.scrollVert(false);
|
||||
for (String category : CATEGORIES) {
|
||||
SettingsTestUtils.assertTitleMatch(mDevice, category);
|
||||
|
Reference in New Issue
Block a user