Support highlightable Settings homepage menu for 2-pane
1. Add a preference group adapter to perform highlighting 2. Add a class for mapping highlighable menu keys and preference keys 3. Add an API to determine if the screen is in split mode Bug: 199017944 Test: manual, build Change-Id: I8e3fe5fb96480a31ee0f3b3afb6ad78999d3d2bc
This commit is contained in:
@@ -136,7 +136,7 @@
|
|||||||
android:taskAffinity="com.android.settings.root"
|
android:taskAffinity="com.android.settings.root"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:configChanges="keyboard|keyboardHidden|screenSize|screenLayout">
|
android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout">
|
||||||
<intent-filter android:priority="1">
|
<intent-filter android:priority="1">
|
||||||
<action android:name="android.settings.SETTINGS" />
|
<action android:name="android.settings.SETTINGS" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
@@ -228,6 +228,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.network.NetworkDashboardFragment"/>
|
android:value="com.android.settings.network.NetworkDashboardFragment"/>
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_network"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -257,6 +259,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment"/>
|
android:value="com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment"/>
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_connected_devices"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -314,6 +318,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.network.NetworkProviderSettings" />
|
android:value="com.android.settings.network.NetworkProviderSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_network"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -479,6 +485,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment" />
|
android:value="com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_connected_devices"/>
|
||||||
</activity-alias>
|
</activity-alias>
|
||||||
|
|
||||||
<!-- Keep compatibility with old shortcuts. -->
|
<!-- Keep compatibility with old shortcuts. -->
|
||||||
@@ -489,6 +497,8 @@
|
|||||||
android:clearTaskOnLaunch="true">
|
android:clearTaskOnLaunch="true">
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment" />
|
android:value="com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_connected_devices"/>
|
||||||
</activity-alias>
|
</activity-alias>
|
||||||
|
|
||||||
<activity android:name="Settings$AssistGestureSettingsActivity"
|
<activity android:name="Settings$AssistGestureSettingsActivity"
|
||||||
@@ -501,6 +511,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.gestures.AssistGestureSettings" />
|
android:value="com.android.settings.gestures.AssistGestureSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_system"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="Settings$FaceSettingsActivity"
|
<activity android:name="Settings$FaceSettingsActivity"
|
||||||
@@ -513,6 +525,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.biometrics.face.FaceSettings" />
|
android:value="com.android.settings.biometrics.face.FaceSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_security"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="Settings$FingerprintSettingsActivity"
|
<activity android:name="Settings$FingerprintSettingsActivity"
|
||||||
@@ -525,6 +539,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.biometrics.fingerprint.FingerprintSettings$FingerprintSettingsFragment" />
|
android:value="com.android.settings.biometrics.fingerprint.FingerprintSettings$FingerprintSettingsFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_security"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="Settings$CombinedBiometricSettingsActivity"
|
<activity android:name="Settings$CombinedBiometricSettingsActivity"
|
||||||
@@ -532,6 +548,8 @@
|
|||||||
android:exported="false">
|
android:exported="false">
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.biometrics.combination.CombinedBiometricSettings" />
|
android:value="com.android.settings.biometrics.combination.CombinedBiometricSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_security"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="Settings$CombinedBiometricProfileSettingsActivity"
|
<activity android:name="Settings$CombinedBiometricProfileSettingsActivity"
|
||||||
@@ -539,6 +557,8 @@
|
|||||||
android:exported="false">
|
android:exported="false">
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.biometrics.combination.CombinedBiometricProfileSettings" />
|
android:value="com.android.settings.biometrics.combination.CombinedBiometricProfileSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_security"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".bluetooth.DevicePickerActivity"
|
<activity android:name=".bluetooth.DevicePickerActivity"
|
||||||
@@ -590,6 +610,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.TetherSettings" />
|
android:value="com.android.settings.TetherSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_network"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -607,6 +629,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.wifi.tether.WifiTetherSettings" />
|
android:value="com.android.settings.wifi.tether.WifiTetherSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_network"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
|
||||||
@@ -618,6 +642,8 @@
|
|||||||
android:targetActivity="Settings$TetherSettingsActivity">
|
android:targetActivity="Settings$TetherSettingsActivity">
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.TetherSettings" />
|
android:value="com.android.settings.TetherSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_network"/>
|
||||||
</activity-alias>
|
</activity-alias>
|
||||||
|
|
||||||
<activity android:name="Settings$WifiP2pSettingsActivity"
|
<activity android:name="Settings$WifiP2pSettingsActivity"
|
||||||
@@ -629,6 +655,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.wifi.p2p.WifiP2pSettings" />
|
android:value="com.android.settings.wifi.p2p.WifiP2pSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_network"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -647,6 +675,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.vpn2.VpnSettings" />
|
android:value="com.android.settings.vpn2.VpnSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_network"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -661,6 +691,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.datausage.DataSaverSummary" />
|
android:value="com.android.settings.datausage.DataSaverSummary" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_network"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -700,6 +732,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.localepicker.LocaleListEditor" />
|
android:value="com.android.settings.localepicker.LocaleListEditor" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_system"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -858,6 +892,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.notification.zen.ZenModeSettings" />
|
android:value="com.android.settings.notification.zen.ZenModeSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_notifications"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -911,6 +947,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.notification.zen.ZenModeAutomationSettings" />
|
android:value="com.android.settings.notification.zen.ZenModeAutomationSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_notifications"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -921,6 +959,8 @@
|
|||||||
android:exported="true">
|
android:exported="true">
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.wallpaper.WallpaperTypeSettings" />
|
android:value="com.android.settings.wallpaper.WallpaperTypeSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_wallpaper"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".wallpaper.WallpaperSuggestionActivity"
|
<activity android:name=".wallpaper.WallpaperSuggestionActivity"
|
||||||
@@ -976,6 +1016,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.notification.zen.ZenModeScheduleRuleSettings" />
|
android:value="com.android.settings.notification.zen.ZenModeScheduleRuleSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_notifications"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -991,6 +1033,8 @@
|
|||||||
android:value="com.android.settings.notification.zen.ZenModeEventRuleSettings" />
|
android:value="com.android.settings.notification.zen.ZenModeEventRuleSettings" />
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_notifications"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -1009,6 +1053,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.DisplaySettings" />
|
android:value="com.android.settings.DisplaySettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_display"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -1028,6 +1074,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.display.SmartAutoRotatePreferenceFragment" />
|
android:value="com.android.settings.display.SmartAutoRotatePreferenceFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_display"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -1046,6 +1094,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.display.NightDisplaySettings" />
|
android:value="com.android.settings.display.NightDisplaySettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_display"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -1065,6 +1115,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.display.darkmode.DarkModeSettingsFragment" />
|
android:value="com.android.settings.display.darkmode.DarkModeSettingsFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_display"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -1088,6 +1140,8 @@
|
|||||||
android:value="true" />
|
android:value="true" />
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.display.NightDisplaySettings" />
|
android:value="com.android.settings.display.NightDisplaySettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_display"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".Settings$MyDeviceInfoActivity"
|
<activity android:name=".Settings$MyDeviceInfoActivity"
|
||||||
@@ -1105,6 +1159,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment" />
|
android:value="com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_about_device"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -1353,6 +1409,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.notification.history.NotificationStation" />
|
android:value="com.android.settings.notification.history.NotificationStation" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_notifications"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -1397,6 +1455,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.location.LocationSettings" />
|
android:value="com.android.settings.location.LocationSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_location"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -1629,6 +1689,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.accessibility.AccessibilitySettings" />
|
android:value="com.android.settings.accessibility.AccessibilitySettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_accessibility"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -1644,6 +1706,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.accessibility.AccessibilityDetailsSettingsFragment" />
|
android:value="com.android.settings.accessibility.AccessibilityDetailsSettingsFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_accessibility"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -1693,6 +1757,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment" />
|
android:value="com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_accessibility"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -1711,6 +1777,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.accessibility.ToggleReduceBrightColorsPreferenceFragment" />
|
android:value="com.android.settings.accessibility.ToggleReduceBrightColorsPreferenceFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_accessibility"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -1725,6 +1793,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.accessibility.CaptionPropertiesFragment" />
|
android:value="com.android.settings.accessibility.CaptionPropertiesFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_accessibility"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -1739,6 +1809,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.tts.TextToSpeechSettings" />
|
android:value="com.android.settings.tts.TextToSpeechSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_accessibility"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -1753,6 +1825,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.enterprise.EnterprisePrivacySettings" />
|
android:value="com.android.settings.enterprise.EnterprisePrivacySettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_privacy"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<!-- Lock screen settings -->
|
<!-- Lock screen settings -->
|
||||||
@@ -2424,6 +2498,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.fuelgauge.PowerUsageSummary" />
|
android:value="com.android.settings.fuelgauge.PowerUsageSummary" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_battery"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -2671,6 +2747,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.notification.NotificationAccessSettings" />
|
android:value="com.android.settings.notification.NotificationAccessSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_notifications"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -2683,6 +2761,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.applications.specialaccess.notificationaccess.NotificationAccessDetails" />
|
android:value="com.android.settings.applications.specialaccess.notificationaccess.NotificationAccessDetails" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_notifications"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -2695,6 +2775,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.notification.ConfigureNotificationSettings" />
|
android:value="com.android.settings.notification.ConfigureNotificationSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_notifications"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -2707,6 +2789,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.applications.specialaccess.vrlistener.VrListenerSettings" />
|
android:value="com.android.settings.applications.specialaccess.vrlistener.VrListenerSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_apps"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -2723,6 +2807,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.applications.specialaccess.pictureinpicture.PictureInPictureSettings" />
|
android:value="com.android.settings.applications.specialaccess.pictureinpicture.PictureInPictureSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_apps"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -2736,6 +2822,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.applications.specialaccess.pictureinpicture.PictureInPictureDetails" />
|
android:value="com.android.settings.applications.specialaccess.pictureinpicture.PictureInPictureDetails" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_apps"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -2748,6 +2836,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.applications.specialaccess.interactacrossprofiles.InteractAcrossProfilesSettings" />
|
android:value="com.android.settings.applications.specialaccess.interactacrossprofiles.InteractAcrossProfilesSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_apps"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="Settings$AppInteractAcrossProfilesSettingsActivity"
|
<activity android:name="Settings$AppInteractAcrossProfilesSettingsActivity"
|
||||||
@@ -2760,6 +2850,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.applications.specialaccess.interactacrossprofiles.InteractAcrossProfilesDetails" />
|
android:value="com.android.settings.applications.specialaccess.interactacrossprofiles.InteractAcrossProfilesDetails" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_apps"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -2774,6 +2866,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.applications.specialaccess.zenaccess.ZenAccessDetails" />
|
android:value="com.android.settings.applications.specialaccess.zenaccess.ZenAccessDetails" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_notifications"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -2786,6 +2880,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.notification.zen.ZenAccessSettings" />
|
android:value="com.android.settings.notification.zen.ZenAccessSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_notifications"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -2802,6 +2898,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.notification.ConfigureNotificationSettings" />
|
android:value="com.android.settings.notification.ConfigureNotificationSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_notifications"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -2816,6 +2914,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.notification.app.ConversationListSettings" />
|
android:value="com.android.settings.notification.app.ConversationListSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_apps"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -2830,6 +2930,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.notification.app.AppBubbleNotificationSettings" />
|
android:value="com.android.settings.notification.app.AppBubbleNotificationSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_apps"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -2877,6 +2979,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.applications.manageapplications.ManageApplications" />
|
android:value="com.android.settings.applications.manageapplications.ManageApplications" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_notifications"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<!-- Show application-level notification settings (app passed in as extras) -->
|
<!-- Show application-level notification settings (app passed in as extras) -->
|
||||||
@@ -2888,6 +2992,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.notification.app.AppNotificationSettings" />
|
android:value="com.android.settings.notification.app.AppNotificationSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_notifications"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<!-- Show channel-level notification settings (channel passed in as extras) -->
|
<!-- Show channel-level notification settings (channel passed in as extras) -->
|
||||||
@@ -3300,6 +3406,8 @@
|
|||||||
android:value="true" />
|
android:value="true" />
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.webview.WebViewAppPicker" />
|
android:value="com.android.settings.webview.WebViewAppPicker" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_system"/>
|
||||||
</activity-alias>
|
</activity-alias>
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
@@ -3338,6 +3446,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.deletionhelper.AutomaticStorageManagerSettings" />
|
android:value="com.android.settings.deletionhelper.AutomaticStorageManagerSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_storage"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<!-- Show app-level advanced power usage details (app passed in as extras) -->
|
<!-- Show app-level advanced power usage details (app passed in as extras) -->
|
||||||
@@ -3361,6 +3471,8 @@
|
|||||||
android:exported="true">
|
android:exported="true">
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.applications.AppDashboardFragment"/>
|
android:value="com.android.settings.applications.AppDashboardFragment"/>
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_apps"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -3378,6 +3490,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.accounts.AccountDashboardFragment"/>
|
android:value="com.android.settings.accounts.AccountDashboardFragment"/>
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_accounts"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -3393,6 +3507,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.system.SystemDashboardFragment"/>
|
android:value="com.android.settings.system.SystemDashboardFragment"/>
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_system"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".support.SupportDashboardActivity"
|
<activity android:name=".support.SupportDashboardActivity"
|
||||||
@@ -3562,6 +3678,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.connecteddevice.AdvancedConnectedDeviceDashboardFragment" />
|
android:value="com.android.settings.connecteddevice.AdvancedConnectedDeviceDashboardFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_connected_devices"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -3576,6 +3694,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.bluetooth.BluetoothDeviceDetailsFragment" />
|
android:value="com.android.settings.bluetooth.BluetoothDeviceDetailsFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_connected_devices"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -3716,6 +3836,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.wifi.calling.WifiCallingDisclaimerFragment" />
|
android:value="com.android.settings.wifi.calling.WifiCallingDisclaimerFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_network"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="Settings$BatterySaverScheduleSettingsActivity"
|
<activity android:name="Settings$BatterySaverScheduleSettingsActivity"
|
||||||
@@ -3727,6 +3849,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.fuelgauge.batterysaver.BatterySaverScheduleSettings" />
|
android:value="com.android.settings.fuelgauge.batterysaver.BatterySaverScheduleSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_battery"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="Settings$PowerMenuSettingsActivity"
|
<activity android:name="Settings$PowerMenuSettingsActivity"
|
||||||
@@ -3738,6 +3862,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.gestures.PowerMenuSettings" />
|
android:value="com.android.settings.gestures.PowerMenuSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_system"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -3755,6 +3881,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.gestures.GestureNavigationSettingsFragment" />
|
android:value="com.android.settings.gestures.GestureNavigationSettingsFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_system"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
@@ -3776,7 +3904,7 @@
|
|||||||
android:permission="android.permission.BLUETOOTH_CONNECT">
|
android:permission="android.permission.BLUETOOTH_CONNECT">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.android.settings.action.LAUNCH_BLUETOOTH_PAIRING"/>
|
<action android:name="com.android.settings.action.LAUNCH_BLUETOOTH_PAIRING"/>
|
||||||
</intent-filter>/>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
|
@@ -83,7 +83,8 @@ public class Settings extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class VpnSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class VpnSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class DataSaverSummaryActivity extends SettingsActivity{ /* empty */ }
|
/** Activity for Data saver settings. */
|
||||||
|
public static class DataSaverSummaryActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class DateTimeSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class DateTimeSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class PrivateVolumeForgetActivity extends SettingsActivity { /* empty */ }
|
public static class PrivateVolumeForgetActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class PublicVolumeSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class PublicVolumeSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
@@ -121,13 +122,9 @@ public class Settings extends SettingsActivity {
|
|||||||
public static class AccessibilityInversionSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class AccessibilityInversionSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class AccessibilityContrastSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class AccessibilityContrastSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class AccessibilityDaltonizerSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class AccessibilityDaltonizerSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
/**
|
/** Activity for lockscreen settings. */
|
||||||
* Activity for lockscreen settings.
|
|
||||||
*/
|
|
||||||
public static class LockScreenSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class LockScreenSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
/**
|
/** Activity for Reduce Bright Colors. */
|
||||||
* Activity for Reduce Bright Colors.
|
|
||||||
*/
|
|
||||||
public static class ReduceBrightColorsSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class ReduceBrightColorsSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
/** Activity for the security dashboard. */
|
/** Activity for the security dashboard. */
|
||||||
public static class SecurityDashboardActivity extends SettingsActivity {
|
public static class SecurityDashboardActivity extends SettingsActivity {
|
||||||
|
@@ -149,9 +149,13 @@ public class SettingsActivity extends SettingsBaseActivity
|
|||||||
public static final String META_DATA_KEY_FRAGMENT_CLASS =
|
public static final String META_DATA_KEY_FRAGMENT_CLASS =
|
||||||
"com.android.settings.FRAGMENT_CLASS";
|
"com.android.settings.FRAGMENT_CLASS";
|
||||||
|
|
||||||
|
public static final String META_DATA_KEY_HIGHLIGHT_MENU_KEY =
|
||||||
|
"com.android.settings.HIGHLIGHT_MENU_KEY";
|
||||||
|
|
||||||
private static final String EXTRA_UI_OPTIONS = "settings:ui_options";
|
private static final String EXTRA_UI_OPTIONS = "settings:ui_options";
|
||||||
|
|
||||||
private String mFragmentClass;
|
private String mFragmentClass;
|
||||||
|
private String mHighlightMenuKey;
|
||||||
|
|
||||||
private CharSequence mInitialTitle;
|
private CharSequence mInitialTitle;
|
||||||
private int mInitialTitleResId;
|
private int mInitialTitleResId;
|
||||||
@@ -234,21 +238,19 @@ public class SettingsActivity extends SettingsBaseActivity
|
|||||||
super.onCreate(savedState);
|
super.onCreate(savedState);
|
||||||
Log.d(LOG_TAG, "Starting onCreate");
|
Log.d(LOG_TAG, "Starting onCreate");
|
||||||
|
|
||||||
if (launchHomepageForTwonPaneDeepLink()) {
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
// Should happen before any call to getIntent()
|
||||||
|
getMetaData();
|
||||||
|
final Intent intent = getIntent();
|
||||||
|
if (launchHomepageForTwoPaneDeepLink(intent)) {
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long startTime = System.currentTimeMillis();
|
|
||||||
|
|
||||||
final FeatureFactory factory = FeatureFactory.getFactory(this);
|
final FeatureFactory factory = FeatureFactory.getFactory(this);
|
||||||
|
|
||||||
mDashboardFeatureProvider = factory.getDashboardFeatureProvider(this);
|
mDashboardFeatureProvider = factory.getDashboardFeatureProvider(this);
|
||||||
|
|
||||||
// Should happen before any call to getIntent()
|
|
||||||
getMetaData();
|
|
||||||
|
|
||||||
final Intent intent = getIntent();
|
|
||||||
if (intent.hasExtra(EXTRA_UI_OPTIONS)) {
|
if (intent.hasExtra(EXTRA_UI_OPTIONS)) {
|
||||||
getWindow().setUiOptions(intent.getIntExtra(EXTRA_UI_OPTIONS, 0));
|
getWindow().setUiOptions(intent.getIntExtra(EXTRA_UI_OPTIONS, 0));
|
||||||
}
|
}
|
||||||
@@ -355,8 +357,7 @@ public class SettingsActivity extends SettingsBaseActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if the Activity is started by a deep link intent for large screen devices. */
|
/** Returns true if the Activity is started by a deep link intent for large screen devices. */
|
||||||
private boolean launchHomepageForTwonPaneDeepLink() {
|
private boolean launchHomepageForTwoPaneDeepLink(Intent intent) {
|
||||||
final Intent intent = getIntent();
|
|
||||||
if (!shouldShowTwoPaneDeepLink(intent)) {
|
if (!shouldShowTwoPaneDeepLink(intent)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -368,6 +369,9 @@ public class SettingsActivity extends SettingsBaseActivity
|
|||||||
trampolineIntent.putExtra(
|
trampolineIntent.putExtra(
|
||||||
android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI,
|
android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI,
|
||||||
intent.toUri(Intent.URI_INTENT_SCHEME));
|
intent.toUri(Intent.URI_INTENT_SCHEME));
|
||||||
|
trampolineIntent.putExtra(
|
||||||
|
android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_HIGHLIGHT_MENU_KEY,
|
||||||
|
mHighlightMenuKey);
|
||||||
trampolineIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
trampolineIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||||
startActivity(trampolineIntent);
|
startActivity(trampolineIntent);
|
||||||
|
|
||||||
@@ -776,6 +780,7 @@ public class SettingsActivity extends SettingsBaseActivity
|
|||||||
PackageManager.GET_META_DATA);
|
PackageManager.GET_META_DATA);
|
||||||
if (ai == null || ai.metaData == null) return;
|
if (ai == null || ai.metaData == null) return;
|
||||||
mFragmentClass = ai.metaData.getString(META_DATA_KEY_FRAGMENT_CLASS);
|
mFragmentClass = ai.metaData.getString(META_DATA_KEY_FRAGMENT_CLASS);
|
||||||
|
mHighlightMenuKey = ai.metaData.getString(META_DATA_KEY_HIGHLIGHT_MENU_KEY);
|
||||||
} catch (NameNotFoundException nnfe) {
|
} catch (NameNotFoundException nnfe) {
|
||||||
// No recovery
|
// No recovery
|
||||||
Log.d(LOG_TAG, "Cannot get Metadata for: " + getComponentName().toString());
|
Log.d(LOG_TAG, "Cannot get Metadata for: " + getComponentName().toString());
|
||||||
|
@@ -119,8 +119,7 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
|||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public HighlightablePreferenceGroupAdapter mAdapter;
|
public HighlightablePreferenceGroupAdapter mAdapter;
|
||||||
@VisibleForTesting
|
private boolean mPreferenceHighlighted = false;
|
||||||
public boolean mPreferenceHighlighted = false;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
|
@@ -1223,6 +1223,14 @@ public final class Utils extends com.android.settingslib.Utils {
|
|||||||
return getColorAttrDefaultColor(context, android.R.attr.textColorSecondary);
|
return getColorAttrDefaultColor(context, android.R.attr.textColorSecondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the highlight color of homepage preference icons.
|
||||||
|
*/
|
||||||
|
@ColorInt
|
||||||
|
public static int getHomepageIconColorHighlight(Context context) {
|
||||||
|
return getColorAttrDefaultColor(context, android.R.attr.textColorSecondaryInverse);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isProviderModelEnabled(Context context) {
|
public static boolean isProviderModelEnabled(Context context) {
|
||||||
return FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL);
|
return FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL);
|
||||||
}
|
}
|
||||||
|
@@ -62,4 +62,12 @@ public class ActivityEmbeddingUtils {
|
|||||||
|
|
||||||
return isFlagEnabled && isSplitSupported;
|
return isFlagEnabled && isSplitSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Whether the screen meets two-pane resolution. */
|
||||||
|
public static boolean isTwoPaneResolution(Context context) {
|
||||||
|
final Context appContext = context.getApplicationContext();
|
||||||
|
final DisplayMetrics dm = appContext.getResources().getDisplayMetrics();
|
||||||
|
return dm.widthPixels >= getMinCurrentScreenSplitWidthPx(appContext)
|
||||||
|
&& dm.heightPixels >= getMinSmallestScreenSplitWidthPx(appContext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,7 @@ package com.android.settings.dashboard;
|
|||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -24,6 +25,7 @@ import android.util.Pair;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
|
import com.android.settings.homepage.HighlightableMenu;
|
||||||
import com.android.settingslib.applications.InterestingConfigChanges;
|
import com.android.settingslib.applications.InterestingConfigChanges;
|
||||||
import com.android.settingslib.drawer.CategoryKey;
|
import com.android.settingslib.drawer.CategoryKey;
|
||||||
import com.android.settingslib.drawer.DashboardCategory;
|
import com.android.settingslib.drawer.DashboardCategory;
|
||||||
@@ -153,6 +155,14 @@ public class CategoryManager {
|
|||||||
filterDuplicateTiles(mCategoryByKeyMap);
|
filterDuplicateTiles(mCategoryByKeyMap);
|
||||||
if (firstLoading) {
|
if (firstLoading) {
|
||||||
logTiles(context);
|
logTiles(context);
|
||||||
|
for (Tile tile : mCategoryByKeyMap.get(CategoryKey.CATEGORY_HOMEPAGE).getTiles()) {
|
||||||
|
final String key = tile.getKey(context);
|
||||||
|
if (TextUtils.isEmpty(key)) {
|
||||||
|
Log.w(TAG, "Key hint missing for homepage tile: " + tile.getTitle(context));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
HighlightableMenu.addMenuKey(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -47,9 +47,9 @@ public interface DashboardFeatureProvider {
|
|||||||
* Binds preference to data provided by tile and gets dynamic data observers.
|
* Binds preference to data provided by tile and gets dynamic data observers.
|
||||||
*
|
*
|
||||||
* @param activity If tile contains intent to launch, it will be launched from this activity
|
* @param activity If tile contains intent to launch, it will be launched from this activity
|
||||||
|
* @param fragment The fragment that the preference will be bound to
|
||||||
* @param forceRoundedIcon Whether or not injected tiles from other packages should be forced to
|
* @param forceRoundedIcon Whether or not injected tiles from other packages should be forced to
|
||||||
* rounded icon.
|
* rounded icon.
|
||||||
* @param sourceMetricsCategory The context (source) from which an action is performed
|
|
||||||
* @param pref The preference to bind data
|
* @param pref The preference to bind data
|
||||||
* @param tile The binding data
|
* @param tile The binding data
|
||||||
* @param key They key for preference. If null, we will generate one from tile data
|
* @param key They key for preference. If null, we will generate one from tile data
|
||||||
@@ -58,7 +58,7 @@ public interface DashboardFeatureProvider {
|
|||||||
* @return The list of dynamic data observers
|
* @return The list of dynamic data observers
|
||||||
*/
|
*/
|
||||||
List<DynamicDataObserver> bindPreferenceToTileAndGetObservers(FragmentActivity activity,
|
List<DynamicDataObserver> bindPreferenceToTileAndGetObservers(FragmentActivity activity,
|
||||||
boolean forceRoundedIcon, int sourceMetricsCategory, Preference pref, Tile tile,
|
DashboardFragment fragment, boolean forceRoundedIcon, Preference pref, Tile tile,
|
||||||
String key, int baseOrder);
|
String key, int baseOrder);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -36,6 +36,7 @@ import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_TITL
|
|||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface.OnCancelListener;
|
||||||
import android.content.IContentProvider;
|
import android.content.IContentProvider;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
@@ -60,6 +61,7 @@ import com.android.settings.R;
|
|||||||
import com.android.settings.SettingsActivity;
|
import com.android.settings.SettingsActivity;
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
import com.android.settings.dashboard.profileselector.ProfileSelectDialog;
|
import com.android.settings.dashboard.profileselector.ProfileSelectDialog;
|
||||||
|
import com.android.settings.homepage.TopLevelSettings;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settings.widget.PrimarySwitchPreference;
|
import com.android.settings.widget.PrimarySwitchPreference;
|
||||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||||
@@ -123,7 +125,7 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DynamicDataObserver> bindPreferenceToTileAndGetObservers(FragmentActivity activity,
|
public List<DynamicDataObserver> bindPreferenceToTileAndGetObservers(FragmentActivity activity,
|
||||||
boolean forceRoundedIcon, int sourceMetricsCategory, Preference pref, Tile tile,
|
DashboardFragment fragment, boolean forceRoundedIcon, Preference pref, Tile tile,
|
||||||
String key, int baseOrder) {
|
String key, int baseOrder) {
|
||||||
if (pref == null) {
|
if (pref == null) {
|
||||||
return null;
|
return null;
|
||||||
@@ -149,6 +151,7 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
|
|||||||
bindIcon(pref, tile, forceRoundedIcon);
|
bindIcon(pref, tile, forceRoundedIcon);
|
||||||
|
|
||||||
if (tile instanceof ActivityTile) {
|
if (tile instanceof ActivityTile) {
|
||||||
|
final int sourceMetricsCategory = fragment.getMetricsCategory();
|
||||||
final Bundle metadata = tile.getMetaData();
|
final Bundle metadata = tile.getMetaData();
|
||||||
String clsName = null;
|
String clsName = null;
|
||||||
String action = null;
|
String action = null;
|
||||||
@@ -166,7 +169,17 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
|
|||||||
intent.setAction(action);
|
intent.setAction(action);
|
||||||
}
|
}
|
||||||
pref.setOnPreferenceClickListener(preference -> {
|
pref.setOnPreferenceClickListener(preference -> {
|
||||||
launchIntentOrSelectProfile(activity, tile, intent, sourceMetricsCategory);
|
OnCancelListener listener = null;
|
||||||
|
if (fragment instanceof TopLevelSettings) {
|
||||||
|
final TopLevelSettings topLevelSettings = (TopLevelSettings) fragment;
|
||||||
|
// Highlight the tile immediately whenever it's clicked
|
||||||
|
topLevelSettings.setHighlightPreferenceKey(key);
|
||||||
|
// If the tile allows users to select profile, the pop-op dialog may be
|
||||||
|
// cancelled and then the previous highlight entry should be restored.
|
||||||
|
listener = dialog -> topLevelSettings.restorePreviousHighlight();
|
||||||
|
}
|
||||||
|
launchIntentOrSelectProfile(activity, tile, intent, sourceMetricsCategory,
|
||||||
|
listener);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -198,7 +211,8 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
|
|||||||
.putExtra(MetricsFeatureProvider.EXTRA_SOURCE_METRICS_CATEGORY,
|
.putExtra(MetricsFeatureProvider.EXTRA_SOURCE_METRICS_CATEGORY,
|
||||||
SettingsEnums.DASHBOARD_SUMMARY)
|
SettingsEnums.DASHBOARD_SUMMARY)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
launchIntentOrSelectProfile(activity, tile, intent, SettingsEnums.DASHBOARD_SUMMARY);
|
launchIntentOrSelectProfile(activity, tile, intent, SettingsEnums.DASHBOARD_SUMMARY,
|
||||||
|
/* listener= */ null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DynamicDataObserver createDynamicDataObserver(String method, Uri uri, Preference pref) {
|
private DynamicDataObserver createDynamicDataObserver(String method, Uri uri, Preference pref) {
|
||||||
@@ -413,7 +427,7 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void launchIntentOrSelectProfile(FragmentActivity activity, Tile tile, Intent intent,
|
private void launchIntentOrSelectProfile(FragmentActivity activity, Tile tile, Intent intent,
|
||||||
int sourceMetricCategory) {
|
int sourceMetricCategory, OnCancelListener listener) {
|
||||||
if (!isIntentResolvable(intent)) {
|
if (!isIntentResolvable(intent)) {
|
||||||
Log.w(TAG, "Cannot resolve intent, skipping. " + intent);
|
Log.w(TAG, "Cannot resolve intent, skipping. " + intent);
|
||||||
return;
|
return;
|
||||||
@@ -439,7 +453,7 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ProfileSelectDialog.show(activity.getSupportFragmentManager(), tile,
|
ProfileSelectDialog.show(activity.getSupportFragmentManager(), tile,
|
||||||
sourceMetricCategory);
|
sourceMetricCategory, listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -496,15 +496,15 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
|
|||||||
if (mDashboardTilePrefKeys.containsKey(key)) {
|
if (mDashboardTilePrefKeys.containsKey(key)) {
|
||||||
// Have the key already, will rebind.
|
// Have the key already, will rebind.
|
||||||
final Preference preference = screen.findPreference(key);
|
final Preference preference = screen.findPreference(key);
|
||||||
mDashboardFeatureProvider.bindPreferenceToTileAndGetObservers(getActivity(),
|
mDashboardFeatureProvider.bindPreferenceToTileAndGetObservers(getActivity(), this,
|
||||||
forceRoundedIcons, getMetricsCategory(), preference, tile, key,
|
forceRoundedIcons, preference, tile, key,
|
||||||
mPlaceholderPreferenceController.getOrder());
|
mPlaceholderPreferenceController.getOrder());
|
||||||
} else {
|
} else {
|
||||||
// Don't have this key, add it.
|
// Don't have this key, add it.
|
||||||
final Preference pref = createPreference(tile);
|
final Preference pref = createPreference(tile);
|
||||||
final List<DynamicDataObserver> observers =
|
final List<DynamicDataObserver> observers =
|
||||||
mDashboardFeatureProvider.bindPreferenceToTileAndGetObservers(getActivity(),
|
mDashboardFeatureProvider.bindPreferenceToTileAndGetObservers(getActivity(),
|
||||||
forceRoundedIcons, getMetricsCategory(), pref, tile, key,
|
this, forceRoundedIcons, pref, tile, key,
|
||||||
mPlaceholderPreferenceController.getOrder());
|
mPlaceholderPreferenceController.getOrder());
|
||||||
screen.addPreference(pref);
|
screen.addPreference(pref);
|
||||||
registerDynamicDataObservers(observers);
|
registerDynamicDataObservers(observers);
|
||||||
|
@@ -19,6 +19,7 @@ package com.android.settings.dashboard.profileselector;
|
|||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.DialogInterface.OnCancelListener;
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -44,19 +45,23 @@ public class ProfileSelectDialog extends DialogFragment implements OnClickListen
|
|||||||
|
|
||||||
private int mSourceMetricCategory;
|
private int mSourceMetricCategory;
|
||||||
private Tile mSelectedTile;
|
private Tile mSelectedTile;
|
||||||
|
private OnCancelListener mOnCancelListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the profile select dialog, adding the fragment to the given FragmentManager.
|
* Display the profile select dialog, adding the fragment to the given FragmentManager.
|
||||||
* @param manager The FragmentManager this fragment will be added to.
|
* @param manager The FragmentManager this fragment will be added to.
|
||||||
* @param tile The tile for this fragment.
|
* @param tile The tile for this fragment.
|
||||||
* @param sourceMetricCategory The source metric category.
|
* @param sourceMetricCategory The source metric category.
|
||||||
|
* @param listener The listener listens to the dialog cancelling event.
|
||||||
*/
|
*/
|
||||||
public static void show(FragmentManager manager, Tile tile, int sourceMetricCategory) {
|
public static void show(FragmentManager manager, Tile tile, int sourceMetricCategory,
|
||||||
|
OnCancelListener listener) {
|
||||||
final ProfileSelectDialog dialog = new ProfileSelectDialog();
|
final ProfileSelectDialog dialog = new ProfileSelectDialog();
|
||||||
final Bundle args = new Bundle();
|
final Bundle args = new Bundle();
|
||||||
args.putParcelable(ARG_SELECTED_TILE, tile);
|
args.putParcelable(ARG_SELECTED_TILE, tile);
|
||||||
args.putInt(ARG_SOURCE_METRIC_CATEGORY, sourceMetricCategory);
|
args.putInt(ARG_SOURCE_METRIC_CATEGORY, sourceMetricCategory);
|
||||||
dialog.setArguments(args);
|
dialog.setArguments(args);
|
||||||
|
dialog.mOnCancelListener = listener;
|
||||||
dialog.show(manager, "select_profile");
|
dialog.show(manager, "select_profile");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,6 +96,13 @@ public class ProfileSelectDialog extends DialogFragment implements OnClickListen
|
|||||||
getActivity().startActivityAsUser(intent, user);
|
getActivity().startActivityAsUser(intent, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancel(DialogInterface dialog) {
|
||||||
|
if (mOnCancelListener != null) {
|
||||||
|
mOnCancelListener.onCancel(dialog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void updateUserHandlesIfNeeded(Context context, Tile tile) {
|
public static void updateUserHandlesIfNeeded(Context context, Tile tile) {
|
||||||
final List<UserHandle> userHandles = tile.userHandle;
|
final List<UserHandle> userHandles = tile.userHandle;
|
||||||
if (tile.userHandle == null || tile.userHandle.size() <= 1) {
|
if (tile.userHandle == null || tile.userHandle.size() <= 1) {
|
||||||
|
117
src/com/android/settings/homepage/HighlightableMenu.java
Normal file
117
src/com/android/settings/homepage/HighlightableMenu.java
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 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.homepage;
|
||||||
|
|
||||||
|
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_HIGHLIGHTABLE_MENU_KEY;
|
||||||
|
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_KEY;
|
||||||
|
|
||||||
|
import android.annotation.XmlRes;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.ArrayMap;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.android.settings.core.PreferenceXmlParserUtils;
|
||||||
|
import com.android.settings.core.PreferenceXmlParserUtils.MetadataFlag;
|
||||||
|
|
||||||
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for mapping highlightable menu keys and preference keys
|
||||||
|
*/
|
||||||
|
public class HighlightableMenu {
|
||||||
|
private static final String TAG = "HighlightableMenu";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map from highlightable menu key to preference key.
|
||||||
|
*/
|
||||||
|
private static final Map<String, String> MENU_TO_PREFERENCE_KEY_MAP;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map from old menu key to current key string id.
|
||||||
|
*/
|
||||||
|
private static final Map<String, Integer> MENU_KEY_COMPAT_MAP;
|
||||||
|
|
||||||
|
private static boolean sXmlParsed;
|
||||||
|
|
||||||
|
static {
|
||||||
|
MENU_TO_PREFERENCE_KEY_MAP = new ArrayMap<>();
|
||||||
|
MENU_KEY_COMPAT_MAP = new ArrayMap<>();
|
||||||
|
|
||||||
|
// Manual mapping for platform compatibility, e.g.
|
||||||
|
// MENU_KEY_COMPAT_MAP.put("top_level_apps_and_notifs", R.string.menu_key_apps);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Parses the highlightable menu keys from xml */
|
||||||
|
public static synchronized void fromXml(Context context, @XmlRes int xmlResId) {
|
||||||
|
if (sXmlParsed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.d(TAG, "parsing highlightable menu from xml");
|
||||||
|
final List<Bundle> preferenceMetadata;
|
||||||
|
try {
|
||||||
|
preferenceMetadata = PreferenceXmlParserUtils.extractMetadata(context, xmlResId,
|
||||||
|
MetadataFlag.FLAG_NEED_KEY | MetadataFlag.FLAG_NEED_HIGHLIGHTABLE_MENU_KEY);
|
||||||
|
} catch (IOException | XmlPullParserException e) {
|
||||||
|
Log.e(TAG, "Failed to parse preference xml for getting highlightable menu keys", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Bundle metadata : preferenceMetadata) {
|
||||||
|
final String menuKey = metadata.getString(METADATA_HIGHLIGHTABLE_MENU_KEY);
|
||||||
|
if (TextUtils.isEmpty(menuKey)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
final String prefKey = metadata.getString(METADATA_KEY);
|
||||||
|
if (TextUtils.isEmpty(prefKey)) {
|
||||||
|
Log.w(TAG, "Highlightable menu requires android:key but it's missing in xml: "
|
||||||
|
+ menuKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
MENU_TO_PREFERENCE_KEY_MAP.put(menuKey, prefKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MENU_TO_PREFERENCE_KEY_MAP.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sXmlParsed = true;
|
||||||
|
MENU_KEY_COMPAT_MAP.forEach((compatMenuKey, keyId) -> {
|
||||||
|
final String prefKey = lookupPreferenceKey(context.getString(keyId));
|
||||||
|
if (prefKey != null) {
|
||||||
|
MENU_TO_PREFERENCE_KEY_MAP.put(compatMenuKey, prefKey);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Manually adds a preference as the menu key for Injection */
|
||||||
|
public static synchronized void addMenuKey(String key) {
|
||||||
|
Log.d(TAG, "add menu key: " + key);
|
||||||
|
MENU_TO_PREFERENCE_KEY_MAP.put(key, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Looks up the preference key by a specified menu key */
|
||||||
|
public static String lookupPreferenceKey(String menuKey) {
|
||||||
|
return MENU_TO_PREFERENCE_KEY_MAP.get(menuKey);
|
||||||
|
}
|
||||||
|
}
|
@@ -16,13 +16,15 @@
|
|||||||
|
|
||||||
package com.android.settings.homepage;
|
package com.android.settings.homepage;
|
||||||
|
|
||||||
|
import static android.provider.Settings.ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK;
|
||||||
|
import static android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI;
|
||||||
|
import static android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_HIGHLIGHT_MENU_KEY;
|
||||||
|
|
||||||
import android.animation.LayoutTransition;
|
import android.animation.LayoutTransition;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.FeatureFlagUtils;
|
import android.util.FeatureFlagUtils;
|
||||||
@@ -36,16 +38,16 @@ import androidx.fragment.app.Fragment;
|
|||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import androidx.window.embedding.SplitController;
|
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.Settings;
|
import com.android.settings.Settings;
|
||||||
|
import com.android.settings.SettingsActivity;
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
import com.android.settings.accounts.AvatarViewMixin;
|
import com.android.settings.accounts.AvatarViewMixin;
|
||||||
import com.android.settings.core.CategoryMixin;
|
|
||||||
import com.android.settings.core.FeatureFlags;
|
|
||||||
import com.android.settings.activityembedding.ActivityEmbeddingRulesController;
|
import com.android.settings.activityembedding.ActivityEmbeddingRulesController;
|
||||||
import com.android.settings.activityembedding.ActivityEmbeddingUtils;
|
import com.android.settings.activityembedding.ActivityEmbeddingUtils;
|
||||||
|
import com.android.settings.core.CategoryMixin;
|
||||||
|
import com.android.settings.core.FeatureFlags;
|
||||||
import com.android.settings.homepage.contextualcards.ContextualCardsFragment;
|
import com.android.settings.homepage.contextualcards.ContextualCardsFragment;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin;
|
import com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin;
|
||||||
@@ -64,6 +66,7 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
|||||||
// An alias class name of SettingsHomepageActivity.
|
// An alias class name of SettingsHomepageActivity.
|
||||||
public static final String ALIAS_DEEP_LINK = "com.android.settings.DeepLinkHomepageActivity";
|
public static final String ALIAS_DEEP_LINK = "com.android.settings.DeepLinkHomepageActivity";
|
||||||
|
|
||||||
|
private static final int DEFAULT_HIGHLIGHT_MENU_KEY = R.string.menu_key_network;
|
||||||
private static final long HOMEPAGE_LOADING_TIMEOUT_MS = 300;
|
private static final long HOMEPAGE_LOADING_TIMEOUT_MS = 300;
|
||||||
|
|
||||||
private View mHomepageView;
|
private View mHomepageView;
|
||||||
@@ -120,7 +123,11 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
|||||||
showFragment(new ContextualCardsFragment(), R.id.contextual_cards_content);
|
showFragment(new ContextualCardsFragment(), R.id.contextual_cards_content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
showFragment(new TopLevelSettings(), R.id.main_content);
|
final Fragment fragment = new TopLevelSettings();
|
||||||
|
fragment.getArguments().putString(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY,
|
||||||
|
getHighlightMenuKey());
|
||||||
|
showFragment(fragment, R.id.main_content);
|
||||||
|
|
||||||
((FrameLayout) findViewById(R.id.main_content))
|
((FrameLayout) findViewById(R.id.main_content))
|
||||||
.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
|
.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
|
||||||
|
|
||||||
@@ -132,9 +139,13 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
|||||||
protected void onNewIntent(Intent intent) {
|
protected void onNewIntent(Intent intent) {
|
||||||
super.onNewIntent(intent);
|
super.onNewIntent(intent);
|
||||||
|
|
||||||
// When it's large screen 2-pane and Settings app is in background. Receiving a Intent
|
// When it's large screen 2-pane and Settings app is in the background, receiving an Intent
|
||||||
// in this Activity will not finish nor onCreate. setIntent here for this case.
|
// will not recreate this activity. Update the intent for this case.
|
||||||
setIntent(intent);
|
setIntent(intent);
|
||||||
|
reloadHighlightMenuKey();
|
||||||
|
if (isFinishing()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Launch the intent from deep link for large screen devices.
|
// Launch the intent from deep link for large screen devices.
|
||||||
launchDeepLinkIntentToRight();
|
launchDeepLinkIntentToRight();
|
||||||
}
|
}
|
||||||
@@ -180,12 +191,12 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
|||||||
|
|
||||||
final Intent intent = getIntent();
|
final Intent intent = getIntent();
|
||||||
if (intent == null || !TextUtils.equals(intent.getAction(),
|
if (intent == null || !TextUtils.equals(intent.getAction(),
|
||||||
android.provider.Settings.ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK)) {
|
ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String intentUriString = intent.getStringExtra(
|
final String intentUriString = intent.getStringExtra(
|
||||||
android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI);
|
EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI);
|
||||||
if (TextUtils.isEmpty(intentUriString)) {
|
if (TextUtils.isEmpty(intentUriString)) {
|
||||||
Log.e(TAG, "No EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI to deep link");
|
Log.e(TAG, "No EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI to deep link");
|
||||||
finish();
|
finish();
|
||||||
@@ -233,6 +244,29 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
|||||||
startActivity(targetIntent);
|
startActivity(targetIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getHighlightMenuKey() {
|
||||||
|
final Intent intent = getIntent();
|
||||||
|
if (intent != null && TextUtils.equals(intent.getAction(),
|
||||||
|
ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK)) {
|
||||||
|
final String menuKey = intent.getStringExtra(
|
||||||
|
EXTRA_SETTINGS_LARGE_SCREEN_HIGHLIGHT_MENU_KEY);
|
||||||
|
if (!TextUtils.isEmpty(menuKey)) {
|
||||||
|
return menuKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getString(DEFAULT_HIGHLIGHT_MENU_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void reloadHighlightMenuKey() {
|
||||||
|
final TopLevelSettings fragment =
|
||||||
|
(TopLevelSettings) getSupportFragmentManager().findFragmentById(R.id.main_content);
|
||||||
|
if (fragment != null) {
|
||||||
|
fragment.getArguments().putString(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY,
|
||||||
|
getHighlightMenuKey());
|
||||||
|
fragment.reloadHighlightMenuKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void initHomepageContainer() {
|
private void initHomepageContainer() {
|
||||||
final View view = findViewById(R.id.homepage_container);
|
final View view = findViewById(R.id.homepage_container);
|
||||||
// Prevent inner RecyclerView gets focus and invokes scrolling.
|
// Prevent inner RecyclerView gets focus and invokes scrolling.
|
||||||
|
@@ -21,20 +21,27 @@ import static com.android.settingslib.search.SearchIndexable.MOBILE;
|
|||||||
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceFragmentCompat;
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.SettingsActivity;
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
|
import com.android.settings.activityembedding.ActivityEmbeddingUtils;
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
import com.android.settings.core.SubSettingLauncher;
|
||||||
import com.android.settings.dashboard.DashboardFragment;
|
import com.android.settings.dashboard.DashboardFragment;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settings.support.SupportPreferenceController;
|
import com.android.settings.support.SupportPreferenceController;
|
||||||
|
import com.android.settings.widget.HighlightableTopLevelPreferenceAdapter;
|
||||||
import com.android.settingslib.core.instrumentation.Instrumentable;
|
import com.android.settingslib.core.instrumentation.Instrumentable;
|
||||||
import com.android.settingslib.search.SearchIndexable;
|
import com.android.settingslib.search.SearchIndexable;
|
||||||
|
|
||||||
@@ -43,6 +50,11 @@ public class TopLevelSettings extends DashboardFragment implements
|
|||||||
PreferenceFragmentCompat.OnPreferenceStartFragmentCallback {
|
PreferenceFragmentCompat.OnPreferenceStartFragmentCallback {
|
||||||
|
|
||||||
private static final String TAG = "TopLevelSettings";
|
private static final String TAG = "TopLevelSettings";
|
||||||
|
private static final String SAVED_HIGHLIGHTED_PREF = "highlighted_pref";
|
||||||
|
|
||||||
|
private HighlightableTopLevelPreferenceAdapter mTopLevelAdapter;
|
||||||
|
|
||||||
|
private String mHighlightedPreferenceKey;
|
||||||
|
|
||||||
public TopLevelSettings() {
|
public TopLevelSettings() {
|
||||||
final Bundle args = new Bundle();
|
final Bundle args = new Bundle();
|
||||||
@@ -69,6 +81,7 @@ public class TopLevelSettings extends DashboardFragment implements
|
|||||||
@Override
|
@Override
|
||||||
public void onAttach(Context context) {
|
public void onAttach(Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
|
HighlightableMenu.fromXml(context, getPreferenceScreenResId());
|
||||||
use(SupportPreferenceController.class).setActivity(getActivity());
|
use(SupportPreferenceController.class).setActivity(getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,6 +96,12 @@ public class TopLevelSettings extends DashboardFragment implements
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceTreeClick(Preference preference) {
|
||||||
|
setHighlightPreferenceKey(preference.getKey());
|
||||||
|
return super.onPreferenceTreeClick(preference);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference pref) {
|
public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference pref) {
|
||||||
new SubSettingLauncher(getActivity())
|
new SubSettingLauncher(getActivity())
|
||||||
@@ -96,6 +115,20 @@ public class TopLevelSettings extends DashboardFragment implements
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
if (icicle != null) {
|
||||||
|
mHighlightedPreferenceKey = icicle.getString(SAVED_HIGHLIGHTED_PREF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
outState.putString(SAVED_HIGHLIGHTED_PREF, mHighlightedPreferenceKey);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
super.onCreatePreferences(savedInstanceState, rootKey);
|
super.onCreatePreferences(savedInstanceState, rootKey);
|
||||||
@@ -118,12 +151,78 @@ public class TopLevelSettings extends DashboardFragment implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
|
highlightPreferenceIfNeeded();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void highlightPreferenceIfNeeded() {
|
||||||
|
if (mTopLevelAdapter != null) {
|
||||||
|
mTopLevelAdapter.requestHighlight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Highlight a preference with specified key */
|
||||||
|
public void setHighlightPreferenceKey(String prefKey) {
|
||||||
|
if (mTopLevelAdapter != null) {
|
||||||
|
mHighlightedPreferenceKey = prefKey;
|
||||||
|
mTopLevelAdapter.highlightPreference(prefKey, /* scrollNeeded= */ false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Highlight the previous preference */
|
||||||
|
public void restorePreviousHighlight() {
|
||||||
|
if (mTopLevelAdapter != null) {
|
||||||
|
mTopLevelAdapter.restorePreviousHighlight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean shouldForceRoundedIcon() {
|
protected boolean shouldForceRoundedIcon() {
|
||||||
return getContext().getResources()
|
return getContext().getResources()
|
||||||
.getBoolean(R.bool.config_force_rounded_icon_TopLevelSettings);
|
.getBoolean(R.bool.config_force_rounded_icon_TopLevelSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected RecyclerView.Adapter onCreateAdapter(PreferenceScreen preferenceScreen) {
|
||||||
|
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(getContext())) {
|
||||||
|
return super.onCreateAdapter(preferenceScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TextUtils.isEmpty(mHighlightedPreferenceKey)) {
|
||||||
|
mHighlightedPreferenceKey = getHighlightPrefKeyFromArguments();
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.d(TAG, "onCreateAdapter, pref key: " + mHighlightedPreferenceKey);
|
||||||
|
mTopLevelAdapter = new HighlightableTopLevelPreferenceAdapter(preferenceScreen,
|
||||||
|
getListView(), mHighlightedPreferenceKey);
|
||||||
|
return mTopLevelAdapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
void reloadHighlightMenuKey() {
|
||||||
|
if (mTopLevelAdapter == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mHighlightedPreferenceKey = getHighlightPrefKeyFromArguments();
|
||||||
|
Log.d(TAG, "reloadHighlightMenuKey, pref key: " + mHighlightedPreferenceKey);
|
||||||
|
mTopLevelAdapter.highlightPreference(mHighlightedPreferenceKey, /* scrollNeeded= */ true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getHighlightPrefKeyFromArguments() {
|
||||||
|
final Bundle arguments = getArguments();
|
||||||
|
final String menuKey = arguments.getString(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY);
|
||||||
|
final String prefKey = HighlightableMenu.lookupPreferenceKey(menuKey);
|
||||||
|
if (TextUtils.isEmpty(prefKey)) {
|
||||||
|
Log.e(TAG, "Invalid highlight menu key: " + menuKey);
|
||||||
|
} else {
|
||||||
|
Log.d(TAG, "Menu key: " + menuKey);
|
||||||
|
}
|
||||||
|
return prefKey;
|
||||||
|
}
|
||||||
|
|
||||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
new BaseSearchIndexProvider(R.xml.top_level_settings) {
|
new BaseSearchIndexProvider(R.xml.top_level_settings) {
|
||||||
|
|
||||||
|
@@ -50,7 +50,7 @@ public class SearchFeatureProviderImpl implements SearchFeatureProvider {
|
|||||||
if (isSettingsPackage || isAllowlistedPackage) {
|
if (isSettingsPackage || isAllowlistedPackage) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new SecurityException("Search result intents must be called with from a "
|
throw new SecurityException("Search result intents must be called with from an "
|
||||||
+ "allowlisted package.");
|
+ "allowlisted package.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,238 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 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.widget;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
import androidx.preference.PreferenceGroup;
|
||||||
|
import androidx.preference.PreferenceGroupAdapter;
|
||||||
|
import androidx.preference.PreferenceViewHolder;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.android.settings.Utils;
|
||||||
|
import com.android.settings.activityembedding.ActivityEmbeddingUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adapter for highlighting top level preferences
|
||||||
|
*/
|
||||||
|
public class HighlightableTopLevelPreferenceAdapter extends PreferenceGroupAdapter {
|
||||||
|
|
||||||
|
private static final String TAG = "HighlightableTopLevelAdapter";
|
||||||
|
|
||||||
|
static final long DELAY_HIGHLIGHT_DURATION_MILLIS = 100L;
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
final int mHighlightColor;
|
||||||
|
final int mTitleColorNormal;
|
||||||
|
final int mTitleColorHighlight;
|
||||||
|
final int mSummaryColorNormal;
|
||||||
|
final int mSummaryColorHighlight;
|
||||||
|
final int mIconColorNormal;
|
||||||
|
final int mIconColorHighlight;
|
||||||
|
|
||||||
|
private final Context mContext;
|
||||||
|
private final RecyclerView mRecyclerView;
|
||||||
|
private final int mNormalBackgroundRes;
|
||||||
|
private String mHighlightKey;
|
||||||
|
private String mPreviousHighlightKey;
|
||||||
|
private int mHighlightPosition = RecyclerView.NO_POSITION;
|
||||||
|
private boolean mHighlightNeeded;
|
||||||
|
private boolean mScrolled;
|
||||||
|
|
||||||
|
public HighlightableTopLevelPreferenceAdapter(PreferenceGroup preferenceGroup,
|
||||||
|
RecyclerView recyclerView, String key) {
|
||||||
|
super(preferenceGroup);
|
||||||
|
mRecyclerView = recyclerView;
|
||||||
|
mHighlightKey = key;
|
||||||
|
mContext = preferenceGroup.getContext();
|
||||||
|
final TypedValue outValue = new TypedValue();
|
||||||
|
mContext.getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
|
||||||
|
outValue, true /* resolveRefs */);
|
||||||
|
mNormalBackgroundRes = outValue.resourceId;
|
||||||
|
mHighlightColor = Utils.getColorAttrDefaultColor(mContext,
|
||||||
|
com.android.internal.R.attr.colorAccentSecondaryVariant);
|
||||||
|
mTitleColorNormal = Utils.getColorAttrDefaultColor(mContext,
|
||||||
|
android.R.attr.textColorPrimary);
|
||||||
|
mTitleColorHighlight = Utils.getColorAttrDefaultColor(mContext,
|
||||||
|
android.R.attr.textColorPrimaryInverse);
|
||||||
|
mSummaryColorNormal = Utils.getColorAttrDefaultColor(mContext,
|
||||||
|
android.R.attr.textColorSecondary);
|
||||||
|
mSummaryColorHighlight = Utils.getColorAttrDefaultColor(mContext,
|
||||||
|
android.R.attr.textColorSecondaryInverse);
|
||||||
|
mIconColorNormal = Utils.getHomepageIconColor(mContext);
|
||||||
|
mIconColorHighlight = Utils.getHomepageIconColorHighlight(mContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(PreferenceViewHolder holder, int position) {
|
||||||
|
super.onBindViewHolder(holder, position);
|
||||||
|
updateBackground(holder, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
void updateBackground(PreferenceViewHolder holder, int position) {
|
||||||
|
if (!isHighlightNeeded()) {
|
||||||
|
removeHighlightBackground(holder);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (position == mHighlightPosition
|
||||||
|
&& mHighlightKey != null
|
||||||
|
&& TextUtils.equals(mHighlightKey, getItem(position).getKey())) {
|
||||||
|
// This position should be highlighted.
|
||||||
|
addHighlightBackground(holder);
|
||||||
|
} else {
|
||||||
|
removeHighlightBackground(holder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function can highlight a specific setting in recycler view.
|
||||||
|
*/
|
||||||
|
public void requestHighlight() {
|
||||||
|
if (mRecyclerView == null || TextUtils.isEmpty(mHighlightKey)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TextUtils.isEmpty(mHighlightKey)) {
|
||||||
|
// De-highlight previous preference.
|
||||||
|
final int previousPosition = mHighlightPosition;
|
||||||
|
mHighlightPosition = RecyclerView.NO_POSITION;
|
||||||
|
mScrolled = true;
|
||||||
|
if (previousPosition >= 0) {
|
||||||
|
notifyItemChanged(previousPosition);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int position = getPreferenceAdapterPosition(mHighlightKey);
|
||||||
|
if (position < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final boolean highlightNeeded = isHighlightNeeded();
|
||||||
|
if (highlightNeeded) {
|
||||||
|
scrollToPositionIfNeeded(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Turn on/off highlight when screen split mode is changed.
|
||||||
|
if (highlightNeeded != mHighlightNeeded) {
|
||||||
|
Log.d(TAG, "Highlight change needed: " + highlightNeeded);
|
||||||
|
mHighlightNeeded = highlightNeeded;
|
||||||
|
mHighlightPosition = position;
|
||||||
|
notifyItemChanged(position);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (position == mHighlightPosition) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int previousPosition = mHighlightPosition;
|
||||||
|
mHighlightPosition = position;
|
||||||
|
Log.d(TAG, "Request highlight position " + position);
|
||||||
|
Log.d(TAG, "Is highlight needed: " + highlightNeeded);
|
||||||
|
if (!highlightNeeded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Highlight preference.
|
||||||
|
notifyItemChanged(position);
|
||||||
|
|
||||||
|
// De-highlight previous preference.
|
||||||
|
if (previousPosition >= 0) {
|
||||||
|
notifyItemChanged(previousPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function that highlights a setting by specifying a preference key. Usually used whenever a
|
||||||
|
* preference is clicked.
|
||||||
|
*/
|
||||||
|
public void highlightPreference(String key, boolean scrollNeeded) {
|
||||||
|
mPreviousHighlightKey = mHighlightKey;
|
||||||
|
mHighlightKey = key;
|
||||||
|
mScrolled = !scrollNeeded;
|
||||||
|
requestHighlight();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function that restores the previous highlighted setting.
|
||||||
|
*/
|
||||||
|
public void restorePreviousHighlight() {
|
||||||
|
mHighlightKey = mPreviousHighlightKey;
|
||||||
|
requestHighlight();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void scrollToPositionIfNeeded(int position) {
|
||||||
|
if (mScrolled || position < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only when the recyclerView is loaded, it can be scrolled
|
||||||
|
final View view = mRecyclerView.getChildAt(position);
|
||||||
|
if (view == null) {
|
||||||
|
mRecyclerView.postDelayed(() -> scrollToPositionIfNeeded(position),
|
||||||
|
DELAY_HIGHLIGHT_DURATION_MILLIS);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mScrolled = true;
|
||||||
|
Log.d(TAG, "Scroll to position " + position);
|
||||||
|
// Scroll to the top to reset the position.
|
||||||
|
mRecyclerView.nestedScrollBy(0, -mRecyclerView.getHeight());
|
||||||
|
|
||||||
|
final int scrollY = view.getTop();
|
||||||
|
if (scrollY > 0) {
|
||||||
|
mRecyclerView.nestedScrollBy(0, scrollY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addHighlightBackground(PreferenceViewHolder holder) {
|
||||||
|
final View v = holder.itemView;
|
||||||
|
v.setBackgroundColor(mHighlightColor);
|
||||||
|
((TextView) v.findViewById(android.R.id.title)).setTextColor(mTitleColorHighlight);
|
||||||
|
((TextView) v.findViewById(android.R.id.summary)).setTextColor(mSummaryColorHighlight);
|
||||||
|
final Drawable drawable = ((ImageView) v.findViewById(android.R.id.icon)).getDrawable();
|
||||||
|
if (drawable != null) {
|
||||||
|
drawable.setTint(mIconColorHighlight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeHighlightBackground(PreferenceViewHolder holder) {
|
||||||
|
final View v = holder.itemView;
|
||||||
|
v.setBackgroundResource(mNormalBackgroundRes);
|
||||||
|
((TextView) v.findViewById(android.R.id.title)).setTextColor(mTitleColorNormal);
|
||||||
|
((TextView) v.findViewById(android.R.id.summary)).setTextColor(mSummaryColorNormal);
|
||||||
|
final Drawable drawable = ((ImageView) v.findViewById(android.R.id.icon)).getDrawable();
|
||||||
|
if (drawable != null) {
|
||||||
|
drawable.setTint(mIconColorNormal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isHighlightNeeded() {
|
||||||
|
return ActivityEmbeddingUtils.isTwoPaneResolution(mContext);
|
||||||
|
}
|
||||||
|
}
|
@@ -43,7 +43,6 @@ import android.os.UserManager;
|
|||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
import com.android.internal.logging.nano.MetricsProto;
|
|
||||||
import com.android.settings.dashboard.DashboardFeatureProviderImpl;
|
import com.android.settings.dashboard.DashboardFeatureProviderImpl;
|
||||||
import com.android.settings.testutils.shadow.ShadowAccountManager;
|
import com.android.settings.testutils.shadow.ShadowAccountManager;
|
||||||
import com.android.settings.testutils.shadow.ShadowUserManager;
|
import com.android.settings.testutils.shadow.ShadowUserManager;
|
||||||
@@ -151,9 +150,9 @@ public class AccountDetailDashboardFragmentTest {
|
|||||||
|
|
||||||
final FragmentActivity activity = Robolectric.setupActivity(FragmentActivity.class);
|
final FragmentActivity activity = Robolectric.setupActivity(FragmentActivity.class);
|
||||||
final Preference preference = new Preference(mContext);
|
final Preference preference = new Preference(mContext);
|
||||||
dashboardFeatureProvider.bindPreferenceToTileAndGetObservers(activity,
|
dashboardFeatureProvider.bindPreferenceToTileAndGetObservers(activity, mFragment,
|
||||||
false /* forceRoundedIcon */, MetricsProto.MetricsEvent.DASHBOARD_SUMMARY,
|
false /* forceRoundedIcon */, preference, tile, null /* key */,
|
||||||
preference, tile, null /* key */, Preference.DEFAULT_ORDER);
|
Preference.DEFAULT_ORDER);
|
||||||
|
|
||||||
assertThat(preference.getKey()).isEqualTo(tile.getKey(mContext));
|
assertThat(preference.getKey()).isEqualTo(tile.getKey(mContext));
|
||||||
preference.performClick();
|
preference.performClick();
|
||||||
|
@@ -114,6 +114,7 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
private Bundle mSwitchMetaData;
|
private Bundle mSwitchMetaData;
|
||||||
private DashboardFeatureProviderImpl mImpl;
|
private DashboardFeatureProviderImpl mImpl;
|
||||||
private boolean mForceRoundedIcon;
|
private boolean mForceRoundedIcon;
|
||||||
|
private DashboardFragment mFragment;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
@@ -144,6 +145,7 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
.thenReturn(new ResolveInfo());
|
.thenReturn(new ResolveInfo());
|
||||||
mFeatureFactory = FakeFeatureFactory.setupForTest();
|
mFeatureFactory = FakeFeatureFactory.setupForTest();
|
||||||
mImpl = new DashboardFeatureProviderImpl(mContext);
|
mImpl = new DashboardFeatureProviderImpl(mContext);
|
||||||
|
mFragment = new TestFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -159,8 +161,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
doReturn(Icon.createWithBitmap(Bitmap.createBitmap(1, 1, Bitmap.Config.RGB_565)))
|
doReturn(Icon.createWithBitmap(Bitmap.createBitmap(1, 1, Bitmap.Config.RGB_565)))
|
||||||
.when(tile).getIcon(any(Context.class));
|
.when(tile).getIcon(any(Context.class));
|
||||||
mActivityInfo.metaData.putString(SettingsActivity.META_DATA_KEY_FRAGMENT_CLASS, "HI");
|
mActivityInfo.metaData.putString(SettingsActivity.META_DATA_KEY_FRAGMENT_CLASS, "HI");
|
||||||
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon,
|
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mFragment, mForceRoundedIcon,
|
||||||
MetricsEvent.SETTINGS_GESTURES, preference, tile, "123", Preference.DEFAULT_ORDER);
|
preference, tile, "123", Preference.DEFAULT_ORDER);
|
||||||
|
|
||||||
assertThat(preference.getTitle()).isEqualTo(mContext.getText(R.string.settings_label));
|
assertThat(preference.getTitle()).isEqualTo(mContext.getText(R.string.settings_label));
|
||||||
assertThat(preference.getSummary())
|
assertThat(preference.getSummary())
|
||||||
@@ -180,8 +182,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
doReturn(Icon.createWithBitmap(Bitmap.createBitmap(1, 1, Bitmap.Config.RGB_565)))
|
doReturn(Icon.createWithBitmap(Bitmap.createBitmap(1, 1, Bitmap.Config.RGB_565)))
|
||||||
.when(tile).getIcon(any(Context.class));
|
.when(tile).getIcon(any(Context.class));
|
||||||
final List<DynamicDataObserver> observers = mImpl.bindPreferenceToTileAndGetObservers(
|
final List<DynamicDataObserver> observers = mImpl.bindPreferenceToTileAndGetObservers(
|
||||||
mActivity, mForceRoundedIcon, MetricsEvent.SETTINGS_GESTURES, preference, tile,
|
mActivity, mFragment, mForceRoundedIcon, preference, tile, null /* key*/,
|
||||||
null /* key*/, Preference.DEFAULT_ORDER);
|
Preference.DEFAULT_ORDER);
|
||||||
|
|
||||||
assertThat(preference.getTitle()).isEqualTo(mContext.getText(R.string.settings_label));
|
assertThat(preference.getTitle()).isEqualTo(mContext.getText(R.string.settings_label));
|
||||||
assertThat(preference.getSummary())
|
assertThat(preference.getSummary())
|
||||||
@@ -198,8 +200,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
mActivityInfo.metaData.putInt(META_DATA_KEY_ORDER, 10);
|
mActivityInfo.metaData.putInt(META_DATA_KEY_ORDER, 10);
|
||||||
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
|
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
|
||||||
|
|
||||||
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon,
|
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mFragment, mForceRoundedIcon,
|
||||||
MetricsEvent.SETTINGS_GESTURES, preference, tile, "123", Preference.DEFAULT_ORDER);
|
preference, tile, "123", Preference.DEFAULT_ORDER);
|
||||||
|
|
||||||
assertThat(preference.getFragment()).isNull();
|
assertThat(preference.getFragment()).isNull();
|
||||||
assertThat(preference.getOnPreferenceClickListener()).isNotNull();
|
assertThat(preference.getOnPreferenceClickListener()).isNotNull();
|
||||||
@@ -214,8 +216,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
tile.userHandle.add(mock(UserHandle.class));
|
tile.userHandle.add(mock(UserHandle.class));
|
||||||
tile.userHandle.add(mock(UserHandle.class));
|
tile.userHandle.add(mock(UserHandle.class));
|
||||||
|
|
||||||
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon,
|
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mFragment, mForceRoundedIcon,
|
||||||
MetricsEvent.SETTINGS_GESTURES, preference, tile, "123", Preference.DEFAULT_ORDER);
|
preference, tile, "123", Preference.DEFAULT_ORDER);
|
||||||
preference.getOnPreferenceClickListener().onPreferenceClick(null);
|
preference.getOnPreferenceClickListener().onPreferenceClick(null);
|
||||||
|
|
||||||
verify(mActivity).getSupportFragmentManager();
|
verify(mActivity).getSupportFragmentManager();
|
||||||
@@ -231,8 +233,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
when(mActivity.getSystemService(Context.USER_SERVICE))
|
when(mActivity.getSystemService(Context.USER_SERVICE))
|
||||||
.thenReturn(mUserManager);
|
.thenReturn(mUserManager);
|
||||||
|
|
||||||
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon,
|
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mFragment, mForceRoundedIcon,
|
||||||
MetricsEvent.SETTINGS_GESTURES, preference, tile, "123", Preference.DEFAULT_ORDER);
|
preference, tile, "123", Preference.DEFAULT_ORDER);
|
||||||
preference.getOnPreferenceClickListener().onPreferenceClick(null);
|
preference.getOnPreferenceClickListener().onPreferenceClick(null);
|
||||||
|
|
||||||
verify(mFeatureFactory.metricsFeatureProvider).logStartedIntent(
|
verify(mFeatureFactory.metricsFeatureProvider).logStartedIntent(
|
||||||
@@ -250,8 +252,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
tile.userHandle = new ArrayList<>();
|
tile.userHandle = new ArrayList<>();
|
||||||
tile.userHandle.add(mock(UserHandle.class));
|
tile.userHandle.add(mock(UserHandle.class));
|
||||||
|
|
||||||
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon,
|
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mFragment, mForceRoundedIcon,
|
||||||
MetricsEvent.SETTINGS_GESTURES, preference, tile, "123", Preference.DEFAULT_ORDER);
|
preference, tile, "123", Preference.DEFAULT_ORDER);
|
||||||
preference.getOnPreferenceClickListener().onPreferenceClick(null);
|
preference.getOnPreferenceClickListener().onPreferenceClick(null);
|
||||||
verify(mFeatureFactory.metricsFeatureProvider).logStartedIntent(
|
verify(mFeatureFactory.metricsFeatureProvider).logStartedIntent(
|
||||||
any(Intent.class),
|
any(Intent.class),
|
||||||
@@ -263,8 +265,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
@Test
|
@Test
|
||||||
public void bindPreference_nullPreference_shouldIgnore() {
|
public void bindPreference_nullPreference_shouldIgnore() {
|
||||||
final Tile tile = mock(Tile.class);
|
final Tile tile = mock(Tile.class);
|
||||||
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon,
|
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mFragment, mForceRoundedIcon,
|
||||||
MetricsEvent.VIEW_UNKNOWN, null, tile, "123", Preference.DEFAULT_ORDER);
|
null /* keys */, tile, "123", Preference.DEFAULT_ORDER);
|
||||||
|
|
||||||
verifyZeroInteractions(tile);
|
verifyZeroInteractions(tile);
|
||||||
}
|
}
|
||||||
@@ -273,8 +275,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
public void bindPreference_withNullKeyNullPriority_shouldGenerateKeyAndPriority() {
|
public void bindPreference_withNullKeyNullPriority_shouldGenerateKeyAndPriority() {
|
||||||
final Preference preference = new Preference(RuntimeEnvironment.application);
|
final Preference preference = new Preference(RuntimeEnvironment.application);
|
||||||
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
|
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
|
||||||
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon,
|
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mFragment, mForceRoundedIcon,
|
||||||
MetricsEvent.VIEW_UNKNOWN, preference, tile, null /*key */,
|
preference, tile, null /* key */,
|
||||||
Preference.DEFAULT_ORDER);
|
Preference.DEFAULT_ORDER);
|
||||||
|
|
||||||
assertThat(preference.getKey()).isNotNull();
|
assertThat(preference.getKey()).isNotNull();
|
||||||
@@ -288,9 +290,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
|
|
||||||
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
|
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
|
||||||
|
|
||||||
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon,
|
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mFragment, mForceRoundedIcon,
|
||||||
MetricsEvent.VIEW_UNKNOWN, preference, tile, null /*key */,
|
preference, tile, null /* key */, Preference.DEFAULT_ORDER);
|
||||||
Preference.DEFAULT_ORDER);
|
|
||||||
|
|
||||||
assertThat(preference.getSummary()).isNull();
|
assertThat(preference.getSummary()).isNull();
|
||||||
}
|
}
|
||||||
@@ -304,8 +305,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
mActivityInfo.metaData.putString(TileUtils.META_DATA_PREFERENCE_SUMMARY_URI, uriString);
|
mActivityInfo.metaData.putString(TileUtils.META_DATA_PREFERENCE_SUMMARY_URI, uriString);
|
||||||
|
|
||||||
final List<DynamicDataObserver> observers = mImpl.bindPreferenceToTileAndGetObservers(
|
final List<DynamicDataObserver> observers = mImpl.bindPreferenceToTileAndGetObservers(
|
||||||
mActivity, mForceRoundedIcon, MetricsEvent.VIEW_UNKNOWN, preference, tile,
|
mActivity, mFragment, mForceRoundedIcon, preference, tile, null /* key */,
|
||||||
null /*key */, Preference.DEFAULT_ORDER);
|
Preference.DEFAULT_ORDER);
|
||||||
|
|
||||||
assertThat(preference.getSummary()).isEqualTo(ShadowTileUtils.MOCK_SUMMARY);
|
assertThat(preference.getSummary()).isEqualTo(ShadowTileUtils.MOCK_SUMMARY);
|
||||||
assertThat(observers.get(0).getUri().toString()).isEqualTo(uriString);
|
assertThat(observers.get(0).getUri().toString()).isEqualTo(uriString);
|
||||||
@@ -320,8 +321,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
mActivityInfo.metaData.putString(TileUtils.META_DATA_PREFERENCE_TITLE_URI, uriString);
|
mActivityInfo.metaData.putString(TileUtils.META_DATA_PREFERENCE_TITLE_URI, uriString);
|
||||||
|
|
||||||
final List<DynamicDataObserver> observers = mImpl.bindPreferenceToTileAndGetObservers(
|
final List<DynamicDataObserver> observers = mImpl.bindPreferenceToTileAndGetObservers(
|
||||||
mActivity, mForceRoundedIcon, MetricsEvent.VIEW_UNKNOWN, preference, tile,
|
mActivity, mFragment, mForceRoundedIcon, preference, tile, null /* key */,
|
||||||
null /*key */, Preference.DEFAULT_ORDER);
|
Preference.DEFAULT_ORDER);
|
||||||
|
|
||||||
assertThat(preference.getTitle()).isEqualTo(ShadowTileUtils.MOCK_SUMMARY);
|
assertThat(preference.getTitle()).isEqualTo(ShadowTileUtils.MOCK_SUMMARY);
|
||||||
assertThat(observers.get(0).getUri().toString()).isEqualTo(uriString);
|
assertThat(observers.get(0).getUri().toString()).isEqualTo(uriString);
|
||||||
@@ -336,9 +337,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
final Bundle bundle = new Bundle();
|
final Bundle bundle = new Bundle();
|
||||||
bundle.putBoolean(EXTRA_SWITCH_SET_CHECKED_ERROR, false);
|
bundle.putBoolean(EXTRA_SWITCH_SET_CHECKED_ERROR, false);
|
||||||
ShadowTileUtils.setResultBundle(bundle);
|
ShadowTileUtils.setResultBundle(bundle);
|
||||||
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon,
|
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mFragment, mForceRoundedIcon,
|
||||||
MetricsEvent.VIEW_UNKNOWN, preference, tile, null /*key */,
|
preference, tile, null /* key */, Preference.DEFAULT_ORDER);
|
||||||
Preference.DEFAULT_ORDER);
|
|
||||||
|
|
||||||
preference.callChangeListener(false);
|
preference.callChangeListener(false);
|
||||||
|
|
||||||
@@ -358,9 +358,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
final Bundle bundle = new Bundle();
|
final Bundle bundle = new Bundle();
|
||||||
bundle.putBoolean(EXTRA_SWITCH_SET_CHECKED_ERROR, true);
|
bundle.putBoolean(EXTRA_SWITCH_SET_CHECKED_ERROR, true);
|
||||||
ShadowTileUtils.setResultBundle(bundle);
|
ShadowTileUtils.setResultBundle(bundle);
|
||||||
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon,
|
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mFragment, mForceRoundedIcon,
|
||||||
MetricsEvent.VIEW_UNKNOWN, preference, tile, null /*key */,
|
preference, tile, null /* key */, Preference.DEFAULT_ORDER);
|
||||||
Preference.DEFAULT_ORDER);
|
|
||||||
|
|
||||||
preference.callChangeListener(true);
|
preference.callChangeListener(true);
|
||||||
|
|
||||||
@@ -378,8 +377,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
final Tile tile = new ProviderTile(mProviderInfo, CategoryKey.CATEGORY_HOMEPAGE,
|
final Tile tile = new ProviderTile(mProviderInfo, CategoryKey.CATEGORY_HOMEPAGE,
|
||||||
mSwitchMetaData);
|
mSwitchMetaData);
|
||||||
final List<DynamicDataObserver> observers = mImpl.bindPreferenceToTileAndGetObservers(
|
final List<DynamicDataObserver> observers = mImpl.bindPreferenceToTileAndGetObservers(
|
||||||
mActivity, mForceRoundedIcon, MetricsEvent.VIEW_UNKNOWN, preference, tile,
|
mActivity, mFragment, mForceRoundedIcon, preference, tile, null /* key */,
|
||||||
null /*key */, Preference.DEFAULT_ORDER);
|
Preference.DEFAULT_ORDER);
|
||||||
|
|
||||||
ShadowTileUtils.setProviderChecked(false);
|
ShadowTileUtils.setProviderChecked(false);
|
||||||
observers.get(0).onDataChanged();
|
observers.get(0).onDataChanged();
|
||||||
@@ -397,9 +396,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
final Preference preference = new Preference(RuntimeEnvironment.application);
|
final Preference preference = new Preference(RuntimeEnvironment.application);
|
||||||
mActivityInfo.metaData.putString(META_DATA_PREFERENCE_KEYHINT, "key");
|
mActivityInfo.metaData.putString(META_DATA_PREFERENCE_KEYHINT, "key");
|
||||||
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
|
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
|
||||||
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon,
|
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mFragment, mForceRoundedIcon,
|
||||||
MetricsEvent.VIEW_UNKNOWN, preference, tile, null /* key */,
|
preference, tile, null /* key */, Preference.DEFAULT_ORDER);
|
||||||
Preference.DEFAULT_ORDER);
|
|
||||||
|
|
||||||
assertThat(preference.getKey()).isEqualTo(tile.getKey(mContext));
|
assertThat(preference.getKey()).isEqualTo(tile.getKey(mContext));
|
||||||
}
|
}
|
||||||
@@ -483,8 +481,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
mActivityInfo.metaData.putInt(META_DATA_KEY_ORDER, 10);
|
mActivityInfo.metaData.putInt(META_DATA_KEY_ORDER, 10);
|
||||||
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
|
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
|
||||||
|
|
||||||
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon,
|
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mFragment, mForceRoundedIcon,
|
||||||
MetricsEvent.VIEW_UNKNOWN, preference, tile, "123", baseOrder);
|
preference, tile, "123", baseOrder);
|
||||||
|
|
||||||
assertThat(preference.getOrder()).isEqualTo(tile.getOrder() + baseOrder);
|
assertThat(preference.getOrder()).isEqualTo(tile.getOrder() + baseOrder);
|
||||||
}
|
}
|
||||||
@@ -496,8 +494,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
mActivityInfo.metaData.putInt(META_DATA_KEY_ORDER, 10);
|
mActivityInfo.metaData.putInt(META_DATA_KEY_ORDER, 10);
|
||||||
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
|
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
|
||||||
mActivityInfo.metaData.putInt(META_DATA_KEY_ORDER, testOrder);
|
mActivityInfo.metaData.putInt(META_DATA_KEY_ORDER, testOrder);
|
||||||
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon,
|
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mFragment, mForceRoundedIcon,
|
||||||
MetricsEvent.VIEW_UNKNOWN, preference, tile, "123", Preference.DEFAULT_ORDER);
|
preference, tile, "123", Preference.DEFAULT_ORDER);
|
||||||
|
|
||||||
assertThat(preference.getOrder()).isEqualTo(testOrder);
|
assertThat(preference.getOrder()).isEqualTo(testOrder);
|
||||||
}
|
}
|
||||||
@@ -508,8 +506,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
|
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
|
||||||
mActivityInfo.metaData.putString(META_DATA_KEY_ORDER, "hello");
|
mActivityInfo.metaData.putString(META_DATA_KEY_ORDER, "hello");
|
||||||
|
|
||||||
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon,
|
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mFragment, mForceRoundedIcon,
|
||||||
MetricsEvent.VIEW_UNKNOWN, preference, tile, "123", Preference.DEFAULT_ORDER);
|
preference, tile, "123", Preference.DEFAULT_ORDER);
|
||||||
|
|
||||||
assertThat(preference.getOrder()).isEqualTo(Preference.DEFAULT_ORDER);
|
assertThat(preference.getOrder()).isEqualTo(Preference.DEFAULT_ORDER);
|
||||||
}
|
}
|
||||||
@@ -522,8 +520,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
mActivityInfo.metaData.putString(META_DATA_PREFERENCE_KEYHINT, "key");
|
mActivityInfo.metaData.putString(META_DATA_PREFERENCE_KEYHINT, "key");
|
||||||
mActivityInfo.metaData.putString("com.android.settings.intent.action", "TestAction");
|
mActivityInfo.metaData.putString("com.android.settings.intent.action", "TestAction");
|
||||||
tile.userHandle = null;
|
tile.userHandle = null;
|
||||||
mImpl.bindPreferenceToTileAndGetObservers(activity, mForceRoundedIcon,
|
mImpl.bindPreferenceToTileAndGetObservers(activity, mFragment, mForceRoundedIcon,
|
||||||
MetricsEvent.SETTINGS_GESTURES, preference, tile, "123", Preference.DEFAULT_ORDER);
|
preference, tile, "123", Preference.DEFAULT_ORDER);
|
||||||
preference.performClick();
|
preference.performClick();
|
||||||
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
|
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
|
||||||
|
|
||||||
@@ -546,8 +544,8 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
mActivityInfo.metaData.putString("com.android.settings.intent.action", "TestAction");
|
mActivityInfo.metaData.putString("com.android.settings.intent.action", "TestAction");
|
||||||
tile.userHandle = null;
|
tile.userHandle = null;
|
||||||
|
|
||||||
mImpl.bindPreferenceToTileAndGetObservers(activity, mForceRoundedIcon,
|
mImpl.bindPreferenceToTileAndGetObservers(activity, mFragment, mForceRoundedIcon,
|
||||||
MetricsEvent.SETTINGS_GESTURES, preference, tile, "123", Preference.DEFAULT_ORDER);
|
preference, tile, "123", Preference.DEFAULT_ORDER);
|
||||||
preference.performClick();
|
preference.performClick();
|
||||||
|
|
||||||
final ShadowActivity.IntentForResult launchIntent =
|
final ShadowActivity.IntentForResult launchIntent =
|
||||||
@@ -669,4 +667,22 @@ public class DashboardFeatureProviderImplTest {
|
|||||||
assertThat(argument.getValue().getIdentifier()).isEqualTo(0);
|
assertThat(argument.getValue().getIdentifier()).isEqualTo(0);
|
||||||
verify(mActivity, never()).getSupportFragmentManager();
|
verify(mActivity, never()).getSupportFragmentManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class TestFragment extends DashboardFragment {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetricsCategory() {
|
||||||
|
return MetricsEvent.SETTINGS_GESTURES;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getPreferenceScreenResId() {
|
||||||
|
return R.xml.gestures;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getLogTag() {
|
||||||
|
return "TestFragment";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user