Update preference screen title.

- Add missing title to preference screen xml so that they will be used to
set the activity title when the fragment is launched.
- Also updated some incorrect preference screen titles.
- Overrides getTitle() in preference fragments that do not use the
preference screen xml.

Bug: 64564191
Test: blaze-bin/screenshots/android/i18nscreenshots/i18nscreenshots
Change-Id: Id72d5ddf18f0962bc484de8bbd847a2e55d6371e
This commit is contained in:
Doris Ling
2017-10-18 14:25:01 -07:00
parent 9d85cfe762
commit 03a3b518de
86 changed files with 838 additions and 93 deletions

View File

@@ -1325,6 +1325,7 @@
</activity> </activity>
<activity android:name="SetFullBackupPassword" <activity android:name="SetFullBackupPassword"
android:label="@string/local_backup_password_title"
android:exported="false"> android:exported="false">
</activity> </activity>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/accessibility_shortcut_service_title" />

View File

@@ -14,8 +14,9 @@
limitations under the License. limitations under the License.
--> -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen
android:title="@string/data_usage_summary_title"> xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/data_usage_app_summary_title">
<com.android.settings.datausage.SpinnerPreference <com.android.settings.datausage.SpinnerPreference
android:key="cycle" /> android:key="cycle" />

View File

@@ -14,9 +14,10 @@
limitations under the License. limitations under the License.
--> -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen
xmlns:settings="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/application_info_label"> xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/storage_label">
<com.android.settings.widget.ActionButtonPreference <com.android.settings.widget.ActionButtonPreference
android:key="header_view" /> android:key="header_view" />

View File

@@ -14,8 +14,9 @@
limitations under the License. limitations under the License.
--> -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen
android:title="@string/data_usage_summary_title"> xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/billing_cycle">
<Preference <Preference
android:key="billing_cycle" android:key="billing_cycle"

View File

@@ -16,7 +16,7 @@
--> -->
<PreferenceScreen <PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/bluetooth_device_advanced_title"> android:title="@string/device_details_title">
<com.android.settings.applications.LayoutPreference <com.android.settings.applications.LayoutPreference
android:key="bluetooth_device_header" android:key="bluetooth_device_header"

View File

@@ -16,7 +16,7 @@
<PreferenceScreen <PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/bluetooth_settings"> android:title="@string/bluetooth_pairing_pref_title">
<Preference <Preference
android:key="device_name"/> android:key="device_name"/>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/screensaver_settings_current" />

View File

@@ -14,8 +14,7 @@
limitations under the License. limitations under the License.
--> -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
android:title="@string/data_usage_summary_title">
<PreferenceCategory <PreferenceCategory
android:key="usage_amount"> android:key="usage_amount">

View File

@@ -15,7 +15,7 @@
--> -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/display_settings"> android:title="@string/network_restrictions">
<PreferenceCategory <PreferenceCategory
android:key="mobile" android:key="mobile"

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/default_assist_title" />

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/autofill_app" />

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/default_browser_title" />

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/default_emergency_app" />

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/home_app" />

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/default_phone_title" />

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/sms_application_title" />

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/voice_input_settings_title" />

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/quick_settings_developer_tiles" />

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/feature_flags_dashboard_title" />

View File

@@ -14,7 +14,9 @@
limitations under the License. limitations under the License.
--> -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/inactive_apps_title">
</PreferenceScreen> </PreferenceScreen>

View File

@@ -14,8 +14,9 @@
limitations under the License. limitations under the License.
--> -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen
android:title="@string/application_info_label"> xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/launch_by_default">
<PreferenceCategory android:key="app_launch_domain_links" <PreferenceCategory android:key="app_launch_domain_links"
android:title="@string/app_launch_domain_links_title"> android:title="@string/app_launch_domain_links_title">

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/domain_urls_title" />

View File

@@ -14,5 +14,7 @@
limitations under the License. limitations under the License.
--> -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/nfc_payment_settings_title">
</PreferenceScreen> </PreferenceScreen>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/manage_notification_access_title" />

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/picture_in_picture_title" />

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/premium_sms_access" />

View File

@@ -16,7 +16,7 @@
<PreferenceScreen <PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/app_memory_use"> android:title="@string/memory_usage_apps">
<PreferenceCategory <PreferenceCategory
android:key="app_list" android:key="app_list"

View File

@@ -14,8 +14,10 @@
limitations under the License. limitations under the License.
--> -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen
xmlns:settings="http://schemas.android.com/apk/res-auto"> xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/tether_settings_title_all">
<com.android.settings.widget.MasterSwitchPreference <com.android.settings.widget.MasterSwitchPreference
android:key="wifi_tether" android:key="wifi_tether"

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/unrestricted_data_saver" />

View File

@@ -15,8 +15,7 @@
--> -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
android:title="@string/vpn_title">
<Preference <Preference
android:key="version" android:key="version"

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/display_vr_pref_title" />

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/vr_listeners_title" />

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/select_webview_provider_title" />

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/screensaver_settings_when_to_dream" />

View File

@@ -15,6 +15,6 @@
--> -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/wifi_saved_access_points_titlebar"> android:title="@string/wifi_display_settings_title">
</PreferenceScreen> </PreferenceScreen>

View File

@@ -14,7 +14,9 @@
limitations under the License. limitations under the License.
--> -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/wifi_p2p_settings_title">
<Preference <Preference
android:key="p2p_this_device" android:key="p2p_this_device"
android:selectable="false" /> android:selectable="false" />

View File

@@ -15,7 +15,9 @@
limitations under the License. limitations under the License.
--> -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/wifi_hotspot_checkbox_text">
<com.android.settings.widget.ValidatedEditTextPreference <com.android.settings.widget.ValidatedEditTextPreference
android:key="wifi_tether_network_name" android:key="wifi_tether_network_name"

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/manage_zen_access_title" />

View File

@@ -49,6 +49,7 @@ import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import com.android.internal.logging.nano.MetricsProto; import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.core.InstrumentedPreferenceFragment;
import com.android.settings.core.instrumentation.Instrumentable; import com.android.settings.core.instrumentation.Instrumentable;
import com.android.settings.core.instrumentation.VisibilityLoggerMixin; import com.android.settings.core.instrumentation.VisibilityLoggerMixin;
@@ -136,6 +137,9 @@ public class DeviceAdminSettings extends ListFragment implements Instrumentable
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
setHasOptionsMenu(true); setHasOptionsMenu(true);
Utils.forceCustomPadding(getListView(), true /* additive padding */); Utils.forceCustomPadding(getListView(), true /* additive padding */);
if (InstrumentedPreferenceFragment.usePreferenceScreenTitle()) {
getActivity().setTitle(R.string.manage_device_admin);
}
} }
@Override @Override

View File

@@ -21,6 +21,7 @@ import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import android.accounts.Account; import android.accounts.Account;
import android.accounts.AccountManager; import android.accounts.AccountManager;
import android.accounts.AuthenticatorDescription; import android.accounts.AuthenticatorDescription;
import android.annotation.StringRes;
import android.app.Activity; import android.app.Activity;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.ContentResolver; import android.content.ContentResolver;
@@ -91,6 +92,12 @@ public class MasterClear extends OptionsMenuFragment {
} }
}; };
@Override
@StringRes
protected int getTitle() {
return R.string.master_clear_title;
}
/** /**
* Keyguard validation is run using the standard {@link ConfirmLockPattern} * Keyguard validation is run using the standard {@link ConfirmLockPattern}
* component as a subactivity * component as a subactivity

View File

@@ -16,6 +16,7 @@
package com.android.settings; package com.android.settings;
import android.annotation.StringRes;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
@@ -63,6 +64,12 @@ public class ResetNetwork extends OptionsMenuFragment {
private Spinner mSubscriptionSpinner; private Spinner mSubscriptionSpinner;
private Button mInitiateButton; private Button mInitiateButton;
@Override
@StringRes
protected int getTitle() {
return R.string.reset_network_title;
}
/** /**
* Keyguard validation is run using the standard {@link ConfirmLockPattern} * Keyguard validation is run using the standard {@link ConfirmLockPattern}
* component as a subactivity * component as a subactivity

View File

@@ -65,6 +65,9 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
final SettingsActivity activity = (SettingsActivity) getActivity(); final SettingsActivity activity = (SettingsActivity) getActivity();
if (usePreferenceScreenTitle()) {
activity.setTitle(R.string.screen_pinning_title);
}
mLockPatternUtils = new LockPatternUtils(activity); mLockPatternUtils = new LockPatternUtils(activity);

View File

@@ -20,6 +20,7 @@ import static android.widget.LinearLayout.LayoutParams.MATCH_PARENT;
import static android.widget.LinearLayout.LayoutParams.WRAP_CONTENT; import static android.widget.LinearLayout.LayoutParams.WRAP_CONTENT;
import android.animation.LayoutTransition; import android.animation.LayoutTransition;
import android.annotation.StringRes;
import android.annotation.UiThread; import android.annotation.UiThread;
import android.app.Activity; import android.app.Activity;
import android.app.KeyguardManager; import android.app.KeyguardManager;
@@ -90,6 +91,12 @@ public class TrustedCredentialsSettings extends OptionsMenuFragment
private static final String USER_ACTION = "com.android.settings.TRUSTED_CREDENTIALS_USER"; private static final String USER_ACTION = "com.android.settings.TRUSTED_CREDENTIALS_USER";
private static final int REQUEST_CONFIRM_CREDENTIALS = 1; private static final int REQUEST_CONFIRM_CREDENTIALS = 1;
@Override
@StringRes
protected int getTitle() {
return R.string.trusted_credentials;
}
@Override @Override
public int getMetricsCategory() { public int getMetricsCategory() {
return MetricsEvent.TRUSTED_CREDENTIALS; return MetricsEvent.TRUSTED_CREDENTIALS;

View File

@@ -18,6 +18,7 @@ package com.android.settings;
import android.annotation.LayoutRes; import android.annotation.LayoutRes;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.annotation.StringRes;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.DialogFragment; import android.app.DialogFragment;
@@ -84,6 +85,12 @@ public class UserCredentialsSettings extends SettingsPreferenceFragment
} }
} }
@Override
@StringRes
protected int getTitle() {
return R.string.user_credentials;
}
protected void announceRemoval(String alias) { protected void announceRemoval(String alias) {
if (!isAdded()) { if (!isAdded()) {
return; return;

View File

@@ -20,6 +20,7 @@ import android.accessibilityservice.AccessibilityServiceInfo;
import android.app.admin.DevicePolicyManager; import android.app.admin.DevicePolicyManager;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo; import android.content.pm.ServiceInfo;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@@ -118,6 +119,7 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
static final String EXTRA_PREFERENCE_KEY = "preference_key"; static final String EXTRA_PREFERENCE_KEY = "preference_key";
static final String EXTRA_CHECKED = "checked"; static final String EXTRA_CHECKED = "checked";
static final String EXTRA_TITLE = "title"; static final String EXTRA_TITLE = "title";
static final String EXTRA_RESOLVE_INFO = "resolve_info";
static final String EXTRA_SUMMARY = "summary"; static final String EXTRA_SUMMARY = "summary";
static final String EXTRA_SETTINGS_TITLE = "settings_title"; static final String EXTRA_SETTINGS_TITLE = "settings_title";
static final String EXTRA_COMPONENT_NAME = "component_name"; static final String EXTRA_COMPONENT_NAME = "component_name";
@@ -464,23 +466,23 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
} }
for (int i = 0, count = installedServices.size(); i < count; ++i) { for (int i = 0, count = installedServices.size(); i < count; ++i) {
AccessibilityServiceInfo info = installedServices.get(i); final AccessibilityServiceInfo info = installedServices.get(i);
final ResolveInfo resolveInfo = info.getResolveInfo();
RestrictedPreference preference = RestrictedPreference preference =
new RestrictedPreference(downloadedServicesCategory.getContext()); new RestrictedPreference(downloadedServicesCategory.getContext());
String title = info.getResolveInfo().loadLabel(getPackageManager()).toString(); final String title = resolveInfo.loadLabel(getPackageManager()).toString();
Drawable icon; Drawable icon;
if (info.getResolveInfo().getIconResource() == 0) { if (resolveInfo.getIconResource() == 0) {
icon = ContextCompat.getDrawable(getContext(), R.mipmap.ic_accessibility_generic); icon = ContextCompat.getDrawable(getContext(), R.mipmap.ic_accessibility_generic);
} else { } else {
icon = info.getResolveInfo().loadIcon(getPackageManager()); icon = resolveInfo.loadIcon(getPackageManager());
} }
ServiceInfo serviceInfo = info.getResolveInfo().serviceInfo; ServiceInfo serviceInfo = resolveInfo.serviceInfo;
String packageName = serviceInfo.packageName; String packageName = serviceInfo.packageName;
ComponentName componentName = new ComponentName(packageName, serviceInfo.name); ComponentName componentName = new ComponentName(packageName, serviceInfo.name);
String componentNameKey = componentName.flattenToString();
preference.setKey(componentName.flattenToString()); preference.setKey(componentName.flattenToString());
@@ -520,6 +522,9 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
extras.putString(EXTRA_PREFERENCE_KEY, preference.getKey()); extras.putString(EXTRA_PREFERENCE_KEY, preference.getKey());
extras.putBoolean(EXTRA_CHECKED, serviceEnabled); extras.putBoolean(EXTRA_CHECKED, serviceEnabled);
extras.putString(EXTRA_TITLE, title); extras.putString(EXTRA_TITLE, title);
if (usePreferenceScreenTitle()) {
extras.putParcelable(EXTRA_RESOLVE_INFO, resolveInfo);
}
String description = info.loadDescription(getPackageManager()); String description = info.loadDescription(getPackageManager());
if (TextUtils.isEmpty(description)) { if (TextUtils.isEmpty(description)) {

View File

@@ -24,7 +24,6 @@ import android.os.UserHandle;
import android.provider.Settings; import android.provider.Settings;
import android.support.v14.preference.SwitchPreference; import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference; import android.support.v7.preference.Preference;
import android.text.TextUtils;
import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityManager;
import android.widget.Switch; import android.widget.Switch;
@@ -60,7 +59,9 @@ public class AccessibilityShortcutPreferenceFragment extends ToggleFeaturePrefer
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.accessibility_shortcut_settings); if (!usePreferenceScreenTitle()) {
addPreferencesFromResource(R.xml.accessibility_shortcut_settings);
}
mServicePreference = findPreference(SHORTCUT_SERVICE_KEY); mServicePreference = findPreference(SHORTCUT_SERVICE_KEY);
mOnLockScreenSwitchPreference = (SwitchPreference) findPreference(ON_LOCK_SCREEN_KEY); mOnLockScreenSwitchPreference = (SwitchPreference) findPreference(ON_LOCK_SCREEN_KEY);
mOnLockScreenSwitchPreference.setOnPreferenceChangeListener((Preference p, Object o) -> { mOnLockScreenSwitchPreference.setOnPreferenceChangeListener((Preference p, Object o) -> {
@@ -79,6 +80,11 @@ public class AccessibilityShortcutPreferenceFragment extends ToggleFeaturePrefer
updatePreferences(); updatePreferences();
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.accessibility_shortcut_settings;
}
@Override @Override
protected void onInstallSwitchBarToggleSwitch() { protected void onInstallSwitchBarToggleSwitch() {
super.onInstallSwitchBarToggleSwitch(); super.onInstallSwitchBarToggleSwitch();

View File

@@ -34,6 +34,7 @@ import android.text.TextUtils;
import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityManager;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.applications.defaultapps.DefaultAppInfo; import com.android.settings.applications.defaultapps.DefaultAppInfo;
import com.android.settings.applications.defaultapps.DefaultAppPickerFragment; import com.android.settings.applications.defaultapps.DefaultAppPickerFragment;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment; import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
@@ -53,6 +54,11 @@ public class ShortcutServicePickerFragment extends DefaultAppPickerFragment {
return MetricsEvent.ACCESSIBILITY_TOGGLE_GLOBAL_GESTURE; return MetricsEvent.ACCESSIBILITY_TOGGLE_GLOBAL_GESTURE;
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.accessibility_shortcut_service_settings;
}
@Override @Override
protected List<? extends DefaultAppInfo> getCandidates() { protected List<? extends DefaultAppInfo> getCandidates() {
final Context context = getContext(); final Context context = getContext();

View File

@@ -109,11 +109,18 @@ public class ToggleAutoclickPreferenceFragment extends ToggleFeaturePreferenceFr
return R.string.help_url_autoclick; return R.string.help_url_autoclick;
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.accessibility_autoclick_settings;
}
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.accessibility_autoclick_settings); if (!usePreferenceScreenTitle()) {
addPreferencesFromResource(R.xml.accessibility_autoclick_settings);
}
int delay = Settings.Secure.getInt( int delay = Settings.Secure.getInt(
getContentResolver(), Settings.Secure.ACCESSIBILITY_AUTOCLICK_DELAY, getContentResolver(), Settings.Secure.ACCESSIBILITY_AUTOCLICK_DELAY,
@@ -153,7 +160,9 @@ public class ToggleAutoclickPreferenceFragment extends ToggleFeaturePreferenceFr
public void onViewCreated(View view, Bundle savedInstanceState) { public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
setTitle(getString(R.string.accessibility_autoclick_preference_title)); if (!usePreferenceScreenTitle()) {
setTitle(getString(R.string.accessibility_autoclick_preference_title));
}
} }
@Override @Override

View File

@@ -50,7 +50,9 @@ public class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePreferenceF
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.accessibility_daltonizer_settings); if (!usePreferenceScreenTitle()) {
addPreferencesFromResource(R.xml.accessibility_daltonizer_settings);
}
mType = (ListPreference) findPreference("type"); mType = (ListPreference) findPreference("type");
@@ -61,6 +63,11 @@ public class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePreferenceF
initPreferences(); initPreferences();
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.accessibility_daltonizer_settings;
}
@Override @Override
protected void onPreferenceToggled(String preferenceKey, boolean enabled) { protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
Settings.Secure.putInt(getContentResolver(), ENABLED, enabled ? 1 : 0); Settings.Secure.putInt(getContentResolver(), ENABLED, enabled ? 1 : 0);
@@ -80,7 +87,9 @@ public class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePreferenceF
public void onViewCreated(View view, Bundle savedInstanceState) { public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
setTitle(getString(R.string.accessibility_display_daltonizer_preference_title)); if (!usePreferenceScreenTitle()) {
setTitle(getString(R.string.accessibility_display_daltonizer_preference_title));
}
} }
@Override @Override

View File

@@ -17,6 +17,7 @@
package com.android.settings.accessibility; package com.android.settings.accessibility;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.preference.Preference; import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen; import android.support.v7.preference.PreferenceScreen;
@@ -49,9 +50,14 @@ public abstract class ToggleFeaturePreferenceFragment
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen( final int resId = getPreferenceScreenResId();
getActivity()); if (usePreferenceScreenTitle() && resId > 0) {
setPreferenceScreen(preferenceScreen); addPreferencesFromResource(resId);
} else {
PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(
getActivity());
setPreferenceScreen(preferenceScreen);
}
} }
@Override @Override
@@ -98,6 +104,13 @@ public abstract class ToggleFeaturePreferenceFragment
// Implement this to reset a checked listener. // Implement this to reset a checked listener.
} }
/**
* Get the res id for static preference xml for this fragment.
*/
protected int getPreferenceScreenResId() {
return -1;
}
private void installActionBarToggleSwitch() { private void installActionBarToggleSwitch() {
mSwitchBar.show(); mSwitchBar.show();
onInstallSwitchBarToggleSwitch(); onInstallSwitchBarToggleSwitch();
@@ -124,7 +137,11 @@ public abstract class ToggleFeaturePreferenceFragment
} }
// Title. // Title.
if (arguments.containsKey(AccessibilitySettings.EXTRA_TITLE)) { if (usePreferenceScreenTitle()
&& arguments.containsKey(AccessibilitySettings.EXTRA_RESOLVE_INFO)) {
ResolveInfo info = arguments.getParcelable(AccessibilitySettings.EXTRA_RESOLVE_INFO);
getActivity().setTitle(info.loadLabel(getPackageManager()).toString());
} else if (arguments.containsKey(AccessibilitySettings.EXTRA_TITLE)) {
setTitle(arguments.getString(AccessibilitySettings.EXTRA_TITLE)); setTitle(arguments.getString(AccessibilitySettings.EXTRA_TITLE));
} }

View File

@@ -17,6 +17,7 @@
package com.android.settings.accessibility; package com.android.settings.accessibility;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.annotation.StringRes;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
@@ -54,6 +55,12 @@ public class ToggleFontSizePreferenceFragment extends PreviewSeekBarPreferenceFr
} }
} }
@Override
@StringRes
protected int getTitle() {
return R.string.title_font_size;
}
@Override @Override
protected Configuration createConfig(Configuration origConfig, int index) { protected Configuration createConfig(Configuration origConfig, int index) {
// Populate the sample layouts. // Populate the sample layouts.

View File

@@ -16,6 +16,7 @@
package com.android.settings.applications; package com.android.settings.applications;
import android.annotation.StringRes;
import android.app.FragmentTransaction; import android.app.FragmentTransaction;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceFrameLayout; import android.preference.PreferenceFrameLayout;
@@ -57,4 +58,11 @@ public class BackgroundCheckSummary extends InstrumentedPreferenceFragment {
return rootView; return rootView;
} }
@Override
@StringRes
protected int getTitle() {
return R.string.background_check_pref;
}
} }

View File

@@ -15,6 +15,7 @@
*/ */
package com.android.settings.applications; package com.android.settings.applications;
import android.annotation.Nullable;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
@@ -28,6 +29,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.SettingsActivity; import com.android.settings.SettingsActivity;
import com.android.settings.core.InstrumentedFragment; import com.android.settings.core.InstrumentedFragment;
import com.android.settings.core.InstrumentedPreferenceFragment;
import com.android.settings.password.ChooseLockSettingsHelper; import com.android.settings.password.ChooseLockSettingsHelper;
/* Class to prompt for conversion of userdata to file based encryption /* Class to prompt for conversion of userdata to file based encryption
@@ -44,6 +46,14 @@ public class ConvertToFbe extends InstrumentedFragment {
res.getText(R.string.convert_to_file_encryption)); res.getText(R.string.convert_to_file_encryption));
} }
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (InstrumentedPreferenceFragment.usePreferenceScreenTitle()) {
getActivity().setTitle(R.string.convert_to_file_encryption);
}
}
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {

View File

@@ -930,11 +930,11 @@ public class InstalledAppDetails extends AppInfoBase
} }
} }
private void startAppInfoFragment(Class<?> fragment, CharSequence title) { private void startAppInfoFragment(Class<?> fragment, int title) {
startAppInfoFragment(fragment, title, this, mAppEntry); startAppInfoFragment(fragment, title, this, mAppEntry);
} }
public static void startAppInfoFragment(Class<?> fragment, CharSequence title, public static void startAppInfoFragment(Class<?> fragment, int title,
SettingsPreferenceFragment caller, AppEntry appEntry) { SettingsPreferenceFragment caller, AppEntry appEntry) {
// start new fragment to display extended information // start new fragment to display extended information
Bundle args = new Bundle(); Bundle args = new Bundle();
@@ -942,7 +942,7 @@ public class InstalledAppDetails extends AppInfoBase
args.putInt(ARG_PACKAGE_UID, appEntry.info.uid); args.putInt(ARG_PACKAGE_UID, appEntry.info.uid);
SettingsActivity sa = (SettingsActivity) caller.getActivity(); SettingsActivity sa = (SettingsActivity) caller.getActivity();
sa.startPreferencePanel(caller, fragment.getName(), args, -1, title, caller, sa.startPreferencePanel(caller, fragment.getName(), args, title, null, caller,
SUB_INFO_FRAGMENT); SUB_INFO_FRAGMENT);
} }
@@ -1018,19 +1018,18 @@ public class InstalledAppDetails extends AppInfoBase
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
if (preference == mStoragePreference) { if (preference == mStoragePreference) {
startAppInfoFragment(AppStorageSettings.class, mStoragePreference.getTitle()); startAppInfoFragment(AppStorageSettings.class, R.string.storage_settings);
} else if (preference == mNotificationPreference) { } else if (preference == mNotificationPreference) {
startAppInfoFragment(AppNotificationSettings.class, startAppInfoFragment(AppNotificationSettings.class, R.string.app_notifications_title);
getString(R.string.app_notifications_title));
} else if (preference == mPermissionsPreference) { } else if (preference == mPermissionsPreference) {
startManagePermissionsActivity(); startManagePermissionsActivity();
} else if (preference == mLaunchPreference) { } else if (preference == mLaunchPreference) {
startAppInfoFragment(AppLaunchSettings.class, mLaunchPreference.getTitle()); startAppInfoFragment(AppLaunchSettings.class, R.string.launch_by_default);
} else if (preference == mMemoryPreference) { } else if (preference == mMemoryPreference) {
ProcessStatsBase.launchMemoryDetail((SettingsActivity) getActivity(), ProcessStatsBase.launchMemoryDetail((SettingsActivity) getActivity(),
mStatsManager.getMemInfo(), mStats, false); mStatsManager.getMemInfo(), mStats, false);
} else if (preference == mDataPreference) { } else if (preference == mDataPreference) {
startAppInfoFragment(AppDataUsage.class, getString(R.string.app_data_usage)); startAppInfoFragment(AppDataUsage.class, R.string.app_data_usage);
} else if (preference == mBatteryPreference) { } else if (preference == mBatteryPreference) {
if (isBatteryStatsAvailable()) { if (isBatteryStatsAvailable()) {
BatteryEntry entry = new BatteryEntry(getContext(), null, mUserManager, mSipper); BatteryEntry entry = new BatteryEntry(getContext(), null, mUserManager, mSipper);
@@ -1109,8 +1108,7 @@ public class InstalledAppDetails extends AppInfoBase
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() { pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
startAppInfoFragment(DrawOverlayDetails.class, startAppInfoFragment(DrawOverlayDetails.class, R.string.draw_overlay);
getString(R.string.draw_overlay));
return true; return true;
} }
}); });
@@ -1123,8 +1121,7 @@ public class InstalledAppDetails extends AppInfoBase
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() { pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
startAppInfoFragment(WriteSettingsDetails.class, startAppInfoFragment(WriteSettingsDetails.class, R.string.write_settings);
getString(R.string.write_settings));
return true; return true;
} }
}); });
@@ -1154,7 +1151,7 @@ public class InstalledAppDetails extends AppInfoBase
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
startAppInfoFragment(ExternalSourcesDetails.class, startAppInfoFragment(ExternalSourcesDetails.class,
getString(R.string.install_other_apps)); R.string.install_other_apps);
return true; return true;
} }
}); });

View File

@@ -63,7 +63,11 @@ public class ManageDomainUrls extends SettingsPreferenceFragment
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
super.onCreate(icicle); super.onCreate(icicle);
setAnimationAllowed(true); setAnimationAllowed(true);
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(getContext())); if (usePreferenceScreenTitle()) {
addPreferencesFromResource(R.xml.manage_domain_url_settings);
} else {
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(getContext()));
}
mApplicationsState = ApplicationsState.getInstance( mApplicationsState = ApplicationsState.getInstance(
(Application) getContext().getApplicationContext()); (Application) getContext().getApplicationContext());
mSession = mApplicationsState.newSession(this, getLifecycle()); mSession = mApplicationsState.newSession(this, getLifecycle());

View File

@@ -147,7 +147,9 @@ public class PictureInPictureSettings extends EmptyTextSettings {
mPackageManager = new PackageManagerWrapper(mContext.getPackageManager()); mPackageManager = new PackageManagerWrapper(mContext.getPackageManager());
mUserManager = new UserManagerWrapper(mContext.getSystemService(UserManager.class)); mUserManager = new UserManagerWrapper(mContext.getSystemService(UserManager.class));
mIconDrawableFactory = IconDrawableFactory.newInstance(mContext); mIconDrawableFactory = IconDrawableFactory.newInstance(mContext);
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(mContext)); if (!usePreferenceScreenTitle()) {
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(mContext));
}
} }
@Override @Override
@@ -198,6 +200,11 @@ public class PictureInPictureSettings extends EmptyTextSettings {
setEmptyText(R.string.picture_in_picture_empty_text); setEmptyText(R.string.picture_in_picture_empty_text);
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.picture_in_picture_settings;
}
@Override @Override
public int getMetricsCategory() { public int getMetricsCategory() {
return MetricsEvent.SETTINGS_MANAGE_PICTURE_IN_PICTURE; return MetricsEvent.SETTINGS_MANAGE_PICTURE_IN_PICTURE;

View File

@@ -80,6 +80,11 @@ public class PremiumSmsAccess extends EmptyTextSettings implements Callback, Cal
super.onDestroy(); super.onDestroy();
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.premium_sms_settings;
}
@Override @Override
public int getMetricsCategory() { public int getMetricsCategory() {
return MetricsProto.MetricsEvent.PREMIUM_SMS_ACCESS; return MetricsProto.MetricsEvent.PREMIUM_SMS_ACCESS;
@@ -119,8 +124,14 @@ public class PremiumSmsAccess extends EmptyTextSettings implements Callback, Cal
if (apps == null) return; if (apps == null) return;
setEmptyText(R.string.premium_sms_none); setEmptyText(R.string.premium_sms_none);
setLoading(false, true); setLoading(false, true);
final PreferenceScreen screen = getPreferenceManager().createPreferenceScreen( final PreferenceScreen screen;
getPrefContext()); if (usePreferenceScreenTitle()) {
screen = getPreferenceScreen();
screen.removeAll();
} else {
screen = getPreferenceManager().createPreferenceScreen(getPrefContext());
}
screen.setOrderingAsAdded(true); screen.setOrderingAsAdded(true);
for (int i = 0; i < apps.size(); i++) { for (int i = 0; i < apps.size(); i++) {
@@ -137,7 +148,9 @@ public class PremiumSmsAccess extends EmptyTextSettings implements Callback, Cal
screen.addPreference(summary); screen.addPreference(summary);
} }
setPreferenceScreen(screen); if (!usePreferenceScreenTitle()) {
setPreferenceScreen(screen);
}
} }
private void update() { private void update() {

View File

@@ -15,6 +15,7 @@
*/ */
package com.android.settings.applications; package com.android.settings.applications;
import android.annotation.StringRes;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
@@ -108,6 +109,12 @@ public class RunningServices extends SettingsPreferenceFragment {
mOptionsMenu.findItem(SHOW_BACKGROUND_PROCESSES).setVisible(!showingBackground); mOptionsMenu.findItem(SHOW_BACKGROUND_PROCESSES).setVisible(!showingBackground);
} }
@Override
@StringRes
protected int getTitle() {
return R.string.runningservices_settings_title;
}
@Override @Override
public int getMetricsCategory() { public int getMetricsCategory() {
return MetricsEvent.RUNNING_SERVICES; return MetricsEvent.RUNNING_SERVICES;

View File

@@ -58,6 +58,11 @@ public class VrListenerSettings extends ManagedServiceSettings {
return super.setEnabled(service, title, enable); return super.setEnabled(service, title, enable);
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.vr_listeners_settings;
}
@VisibleForTesting @VisibleForTesting
void logSpecialPermissionChange(boolean enable, String packageName) { void logSpecialPermissionChange(boolean enable, String packageName) {
int logCategory = enable ? MetricsEvent.APP_SPECIAL_PERMISSION_VRHELPER_ALLOW int logCategory = enable ? MetricsEvent.APP_SPECIAL_PERMISSION_VRHELPER_ALLOW

View File

@@ -64,6 +64,11 @@ public class DefaultAssistPicker extends DefaultAppPickerFragment {
mAssistUtils = new AssistUtils(context); mAssistUtils = new AssistUtils(context);
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.default_assist_settings;
}
@Override @Override
protected List<DefaultAppInfo> getCandidates() { protected List<DefaultAppInfo> getCandidates() {
mAvailableAssistants.clear(); mAvailableAssistants.clear();

View File

@@ -24,6 +24,7 @@ import android.text.TextUtils;
import com.android.internal.app.AssistUtils; import com.android.internal.app.AssistUtils;
import com.android.internal.logging.nano.MetricsProto; import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.applications.defaultapps.DefaultAppInfo; import com.android.settings.applications.defaultapps.DefaultAppInfo;
import com.android.settings.applications.defaultapps.DefaultAppPickerFragment; import com.android.settings.applications.defaultapps.DefaultAppPickerFragment;
import com.android.settingslib.wrapper.PackageManagerWrapper; import com.android.settingslib.wrapper.PackageManagerWrapper;
@@ -54,6 +55,11 @@ public class DefaultVoiceInputPicker extends DefaultAppPickerFragment {
} }
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.default_voice_settings;
}
@Override @Override
protected List<VoiceInputDefaultAppInfo> getCandidates() { protected List<VoiceInputDefaultAppInfo> getCandidates() {
final List<VoiceInputDefaultAppInfo> candidates = new ArrayList<>(); final List<VoiceInputDefaultAppInfo> candidates = new ArrayList<>();

View File

@@ -18,9 +18,7 @@ package com.android.settings.applications.defaultapps;
import android.Manifest; import android.Manifest;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
@@ -30,7 +28,6 @@ import android.content.pm.ServiceInfo;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper;
import android.provider.Settings; import android.provider.Settings;
import android.service.autofill.AutofillService; import android.service.autofill.AutofillService;
import android.service.autofill.AutofillServiceInfo; import android.service.autofill.AutofillServiceInfo;
@@ -105,6 +102,11 @@ public class DefaultAutofillPicker extends DefaultAppPickerFragment {
} }
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.default_autofill_settings;
}
@Override @Override
public int getMetricsCategory() { public int getMetricsCategory() {
return MetricsProto.MetricsEvent.DEFAULT_AUTOFILL_PICKER; return MetricsProto.MetricsEvent.DEFAULT_AUTOFILL_PICKER;

View File

@@ -21,6 +21,7 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import com.android.internal.logging.nano.MetricsProto; import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -30,6 +31,11 @@ import java.util.List;
*/ */
public class DefaultBrowserPicker extends DefaultAppPickerFragment { public class DefaultBrowserPicker extends DefaultAppPickerFragment {
@Override
protected int getPreferenceScreenResId() {
return R.xml.default_browser_settings;
}
@Override @Override
public int getMetricsCategory() { public int getMetricsCategory() {
return MetricsProto.MetricsEvent.DEFAULT_BROWSER_PICKER; return MetricsProto.MetricsEvent.DEFAULT_BROWSER_PICKER;

View File

@@ -39,6 +39,11 @@ public class DefaultEmergencyPicker extends DefaultAppPickerFragment {
return MetricsProto.MetricsEvent.DEFAULT_EMERGENCY_APP_PICKER; return MetricsProto.MetricsEvent.DEFAULT_EMERGENCY_APP_PICKER;
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.default_emergency_settings;
}
@Override @Override
protected List<DefaultAppInfo> getCandidates() { protected List<DefaultAppInfo> getCandidates() {
final List<DefaultAppInfo> candidates = new ArrayList<>(); final List<DefaultAppInfo> candidates = new ArrayList<>();

View File

@@ -43,6 +43,11 @@ public class DefaultHomePicker extends DefaultAppPickerFragment {
mPackageName = context.getPackageName(); mPackageName = context.getPackageName();
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.default_home_settings;
}
@Override @Override
public int getMetricsCategory() { public int getMetricsCategory() {
return MetricsProto.MetricsEvent.DEFAULT_HOME_PICKER; return MetricsProto.MetricsEvent.DEFAULT_HOME_PICKER;

View File

@@ -23,6 +23,7 @@ import android.telecom.TelecomManager;
import android.text.TextUtils; import android.text.TextUtils;
import com.android.internal.logging.nano.MetricsProto; import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -43,6 +44,11 @@ public class DefaultPhonePicker extends DefaultAppPickerFragment {
(TelecomManager) context.getSystemService(Context.TELECOM_SERVICE)); (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE));
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.default_phone_settings;
}
@Override @Override
protected List<DefaultAppInfo> getCandidates() { protected List<DefaultAppInfo> getCandidates() {
final List<DefaultAppInfo> candidates = new ArrayList<>(); final List<DefaultAppInfo> candidates = new ArrayList<>();

View File

@@ -39,6 +39,11 @@ public class DefaultSmsPicker extends DefaultAppPickerFragment {
return MetricsProto.MetricsEvent.DEFAULT_SMS_PICKER; return MetricsProto.MetricsEvent.DEFAULT_SMS_PICKER;
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.default_sms_settings;
}
@Override @Override
protected List<DefaultAppInfo> getCandidates() { protected List<DefaultAppInfo> getCandidates() {
final Context context = getContext(); final Context context = getContext();

View File

@@ -223,10 +223,13 @@ public class ManageApplications extends InstrumentedPreferenceFragment
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setHasOptionsMenu(true); setHasOptionsMenu(true);
mApplicationsState = ApplicationsState.getInstance(getActivity().getApplication()); final Activity activity = getActivity();
mApplicationsState = ApplicationsState.getInstance(activity.getApplication());
Intent intent = getActivity().getIntent(); Intent intent = activity.getIntent();
Bundle args = getArguments(); Bundle args = getArguments();
int screenTitle = intent.getIntExtra(
SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RESID, R.string.notifications_label);
String className = args != null ? args.getString(EXTRA_CLASSNAME) : null; String className = args != null ? args.getString(EXTRA_CLASSNAME) : null;
if (className == null) { if (className == null) {
className = intent.getComponent().getClassName(); className = intent.getComponent().getClassName();
@@ -235,6 +238,7 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|| this instanceof NotificationApps) { || this instanceof NotificationApps) {
mListType = LIST_TYPE_NOTIFICATION; mListType = LIST_TYPE_NOTIFICATION;
mNotifBackend = new NotificationBackend(); mNotifBackend = new NotificationBackend();
screenTitle = R.string.app_notifications_title;
} else if (className.equals(StorageUseActivity.class.getName())) { } else if (className.equals(StorageUseActivity.class.getName())) {
if (args != null && args.containsKey(EXTRA_VOLUME_UUID)) { if (args != null && args.containsKey(EXTRA_VOLUME_UUID)) {
mVolumeUuid = args.getString(EXTRA_VOLUME_UUID); mVolumeUuid = args.getString(EXTRA_VOLUME_UUID);
@@ -247,16 +251,21 @@ public class ManageApplications extends InstrumentedPreferenceFragment
mSortOrder = R.id.sort_order_size; mSortOrder = R.id.sort_order_size;
} else if (className.equals(UsageAccessSettingsActivity.class.getName())) { } else if (className.equals(UsageAccessSettingsActivity.class.getName())) {
mListType = LIST_TYPE_USAGE_ACCESS; mListType = LIST_TYPE_USAGE_ACCESS;
screenTitle = R.string.usage_access;
} else if (className.equals(HighPowerApplicationsActivity.class.getName())) { } else if (className.equals(HighPowerApplicationsActivity.class.getName())) {
mListType = LIST_TYPE_HIGH_POWER; mListType = LIST_TYPE_HIGH_POWER;
// Default to showing system. // Default to showing system.
mShowSystem = true; mShowSystem = true;
screenTitle = R.string.high_power_apps;
} else if (className.equals(OverlaySettingsActivity.class.getName())) { } else if (className.equals(OverlaySettingsActivity.class.getName())) {
mListType = LIST_TYPE_OVERLAY; mListType = LIST_TYPE_OVERLAY;
screenTitle = R.string.system_alert_window_settings;
} else if (className.equals(WriteSettingsActivity.class.getName())) { } else if (className.equals(WriteSettingsActivity.class.getName())) {
mListType = LIST_TYPE_WRITE_SETTINGS; mListType = LIST_TYPE_WRITE_SETTINGS;
screenTitle = R.string.write_settings;
} else if (className.equals(ManageExternalSourcesActivity.class.getName())) { } else if (className.equals(ManageExternalSourcesActivity.class.getName())) {
mListType = LIST_TYPE_MANAGE_SOURCES; mListType = LIST_TYPE_MANAGE_SOURCES;
screenTitle = R.string.install_other_apps;
} else if (className.equals(GamesStorageActivity.class.getName())) { } else if (className.equals(GamesStorageActivity.class.getName())) {
mListType = LIST_TYPE_GAMES; mListType = LIST_TYPE_GAMES;
mSortOrder = R.id.sort_order_size; mSortOrder = R.id.sort_order_size;
@@ -280,9 +289,13 @@ public class ManageApplications extends InstrumentedPreferenceFragment
mShowSystem = savedInstanceState.getBoolean(EXTRA_SHOW_SYSTEM, mShowSystem); mShowSystem = savedInstanceState.getBoolean(EXTRA_SHOW_SYSTEM, mShowSystem);
} }
mInvalidSizeStr = getActivity().getText(R.string.invalid_size_value); mInvalidSizeStr = activity.getText(R.string.invalid_size_value);
mResetAppsHelper = new ResetAppsHelper(getActivity()); mResetAppsHelper = new ResetAppsHelper(activity);
if (usePreferenceScreenTitle() && screenTitle > 0) {
activity.setTitle(screenTitle);
}
} }
@Override @Override

View File

@@ -16,23 +16,36 @@ package com.android.settings.datausage;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.TypedArray;
import android.net.NetworkTemplate; import android.net.NetworkTemplate;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.res.TypedArrayUtils;
import android.support.v7.preference.Preference; import android.support.v7.preference.Preference;
import android.text.format.Formatter; import android.text.format.Formatter;
import android.util.AttributeSet; import android.util.AttributeSet;
import com.android.internal.logging.nano.MetricsProto; import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.Utils; import com.android.settings.Utils;
import com.android.settings.core.InstrumentedPreferenceFragment;
import com.android.settingslib.net.DataUsageController; import com.android.settingslib.net.DataUsageController;
public class DataUsagePreference extends Preference implements TemplatePreference { public class DataUsagePreference extends Preference implements TemplatePreference {
private NetworkTemplate mTemplate; private NetworkTemplate mTemplate;
private int mSubId; private int mSubId;
private int mTitleRes;
public DataUsagePreference(Context context, AttributeSet attrs) { public DataUsagePreference(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
if (InstrumentedPreferenceFragment.usePreferenceScreenTitle()) {
final TypedArray a = context.obtainStyledAttributes(
attrs, new int[] { com.android.internal.R.attr.title },
TypedArrayUtils.getAttr(
context, android.support.v7.preference.R.attr.preferenceStyle,
android.R.attr.preferenceStyle), 0);
mTitleRes = a.getResourceId(0, 0);
a.recycle();
}
} }
@Override @Override
@@ -52,6 +65,11 @@ public class DataUsagePreference extends Preference implements TemplatePreferenc
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putParcelable(DataUsageList.EXTRA_NETWORK_TEMPLATE, mTemplate); args.putParcelable(DataUsageList.EXTRA_NETWORK_TEMPLATE, mTemplate);
args.putInt(DataUsageList.EXTRA_SUB_ID, mSubId); args.putInt(DataUsageList.EXTRA_SUB_ID, mSubId);
if (mTitleRes > 0) {
return Utils.onBuildStartFragmentIntent(getContext(), DataUsageList.class.getName(),
args, getContext().getPackageName(), mTitleRes, null, false,
MetricsProto.MetricsEvent.VIEW_UNKNOWN);
}
return Utils.onBuildStartFragmentIntent(getContext(), DataUsageList.class.getName(), args, return Utils.onBuildStartFragmentIntent(getContext(), DataUsageList.class.getName(), args,
getContext().getPackageName(), 0, getTitle(), false, getContext().getPackageName(), 0, getTitle(), false,
MetricsProto.MetricsEvent.VIEW_UNKNOWN); MetricsProto.MetricsEvent.VIEW_UNKNOWN);

View File

@@ -59,7 +59,11 @@ public class UnrestrictedDataAccess extends SettingsPreferenceFragment
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
super.onCreate(icicle); super.onCreate(icicle);
setAnimationAllowed(true); setAnimationAllowed(true);
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(getContext())); if (usePreferenceScreenTitle()) {
addPreferencesFromResource(R.xml.unrestricted_data_access_settings);
} else {
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(getContext()));
}
mApplicationsState = ApplicationsState.getInstance( mApplicationsState = ApplicationsState.getInstance(
(Application) getContext().getApplicationContext()); (Application) getContext().getApplicationContext());
mDataSaverBackend = new DataSaverBackend(getContext()); mDataSaverBackend = new DataSaverBackend(getContext());
@@ -267,7 +271,7 @@ public class UnrestrictedDataAccess extends SettingsPreferenceFragment
if (mState.isDataSaverBlacklisted) { if (mState.isDataSaverBlacklisted) {
// app is blacklisted, launch App Data Usage screen // app is blacklisted, launch App Data Usage screen
InstalledAppDetails.startAppInfoFragment(AppDataUsage.class, InstalledAppDetails.startAppInfoFragment(AppDataUsage.class,
getContext().getString(R.string.app_data_usage), R.string.app_data_usage,
UnrestrictedDataAccess.this, UnrestrictedDataAccess.this,
mEntry); mEntry);
} else { } else {

View File

@@ -34,6 +34,7 @@ import android.widget.TextView;
import com.android.internal.logging.nano.MetricsProto; import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.core.InstrumentedPreferenceFragment;
import com.android.settings.core.instrumentation.Instrumentable; import com.android.settings.core.instrumentation.Instrumentable;
import com.android.settings.core.instrumentation.VisibilityLoggerMixin; import com.android.settings.core.instrumentation.VisibilityLoggerMixin;
import com.android.settingslib.datetime.ZoneGetter; import com.android.settingslib.datetime.ZoneGetter;
@@ -164,6 +165,9 @@ public class ZonePicker extends ListFragment implements Instrumentable {
// Sets the adapter // Sets the adapter
setSorting(true); setSorting(true);
setHasOptionsMenu(true); setHasOptionsMenu(true);
if (InstrumentedPreferenceFragment.usePreferenceScreenTitle()) {
activity.setTitle(R.string.date_time_set_timezone);
}
} }
@Override @Override

View File

@@ -42,7 +42,7 @@ public class FeatureFlagsDashboard extends DashboardFragment {
@Override @Override
protected int getPreferenceScreenResId() { protected int getPreferenceScreenResId() {
return R.xml.placeholder_prefs; return R.xml.feature_flags_settings;
} }
@Override @Override

View File

@@ -29,7 +29,6 @@ import java.util.List;
public class DevelopmentTileConfigFragment extends DashboardFragment { public class DevelopmentTileConfigFragment extends DashboardFragment {
private static final String TAG = "DevelopmentTileConfig"; private static final String TAG = "DevelopmentTileConfig";
@Override @Override
protected String getLogTag() { protected String getLogTag() {
return TAG; return TAG;
@@ -37,7 +36,7 @@ public class DevelopmentTileConfigFragment extends DashboardFragment {
@Override @Override
protected int getPreferenceScreenResId() { protected int getPreferenceScreenResId() {
return R.xml.placeholder_prefs; return R.xml.development_tile_settings;
} }
@Override @Override

View File

@@ -17,6 +17,7 @@
package com.android.settings.display; package com.android.settings.display;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.annotation.StringRes;
import android.content.Context; import android.content.Context;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
@@ -98,6 +99,12 @@ public class ScreenZoomSettings extends PreviewSeekBarPreferenceFragment impleme
return R.string.help_url_display_size; return R.string.help_url_display_size;
} }
@Override
@StringRes
protected int getTitle() {
return R.string.screen_zoom_title;
}
@Override @Override
public int getMetricsCategory() { public int getMetricsCategory() {
return MetricsEvent.DISPLAY_SCREEN_ZOOM; return MetricsEvent.DISPLAY_SCREEN_ZOOM;

View File

@@ -32,6 +32,11 @@ public class VrDisplayPreferencePicker extends RadioButtonPickerFragment {
static final String PREF_KEY_PREFIX = "vr_display_pref_"; static final String PREF_KEY_PREFIX = "vr_display_pref_";
@Override
protected int getPreferenceScreenResId() {
return R.xml.vr_display_settings;
}
@Override @Override
public int getMetricsCategory() { public int getMetricsCategory() {
return MetricsProto.MetricsEvent.VR_DISPLAY_PREFERENCE; return MetricsProto.MetricsEvent.VR_DISPLAY_PREFERENCE;

View File

@@ -16,11 +16,11 @@
package com.android.settings.dream; package com.android.settings.dream;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import com.android.internal.logging.nano.MetricsProto; import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.widget.RadioButtonPickerFragment; import com.android.settings.widget.RadioButtonPickerFragment;
import com.android.settingslib.dream.DreamBackend; import com.android.settingslib.dream.DreamBackend;
import com.android.settingslib.dream.DreamBackend.DreamInfo; import com.android.settingslib.dream.DreamBackend.DreamInfo;
@@ -40,6 +40,11 @@ public final class CurrentDreamPicker extends RadioButtonPickerFragment {
mBackend = DreamBackend.getInstance(context); mBackend = DreamBackend.getInstance(context);
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.current_dream_settings;
}
@Override @Override
public int getMetricsCategory() { public int getMetricsCategory() {
return MetricsProto.MetricsEvent.DREAM; return MetricsProto.MetricsEvent.DREAM;

View File

@@ -37,6 +37,11 @@ public class WhenToDreamPicker extends RadioButtonPickerFragment {
mBackend = DreamBackend.getInstance(context); mBackend = DreamBackend.getInstance(context);
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.when_to_dream_settings;
}
@Override @Override
public int getMetricsCategory() { public int getMetricsCategory() {
return MetricsProto.MetricsEvent.DREAM; return MetricsProto.MetricsEvent.DREAM;

View File

@@ -16,6 +16,7 @@
package com.android.settings.nfc; package com.android.settings.nfc;
import android.annotation.StringRes;
import android.nfc.NfcAdapter; import android.nfc.NfcAdapter;
import android.os.Bundle; import android.os.Bundle;
import android.os.UserHandle; import android.os.UserHandle;
@@ -130,4 +131,10 @@ public class AndroidBeam extends InstrumentedPreferenceFragment
public int getMetricsCategory() { public int getMetricsCategory() {
return MetricsEvent.NFC_BEAM; return MetricsEvent.NFC_BEAM;
} }
@Override
@StringRes
protected int getTitle() {
return R.string.android_beam_settings_title;
}
} }

View File

@@ -58,8 +58,14 @@ public class PaymentSettings extends SettingsPreferenceFragment implements Index
mPaymentBackend = new PaymentBackend(getActivity()); mPaymentBackend = new PaymentBackend(getActivity());
setHasOptionsMenu(true); setHasOptionsMenu(true);
PreferenceManager manager = getPreferenceManager(); final PreferenceScreen screen;
PreferenceScreen screen = manager.createPreferenceScreen(getActivity()); if (usePreferenceScreenTitle()) {
addPreferencesFromResource(R.xml.nfc_payment_settings);
screen = getPreferenceScreen();
} else {
PreferenceManager manager = getPreferenceManager();
screen = manager.createPreferenceScreen(getActivity());
}
List<PaymentBackend.PaymentAppInfo> appInfos = mPaymentBackend.getPaymentAppInfos(); List<PaymentBackend.PaymentAppInfo> appInfos = mPaymentBackend.getPaymentAppInfos();
if (appInfos != null && appInfos.size() > 0) { if (appInfos != null && appInfos.size() > 0) {
@@ -71,7 +77,9 @@ public class PaymentSettings extends SettingsPreferenceFragment implements Index
mPaymentBackend); mPaymentBackend);
screen.addPreference(foreground); screen.addPreference(foreground);
} }
setPreferenceScreen(screen); if (!usePreferenceScreenTitle()) {
setPreferenceScreen(screen);
}
} }
@Override @Override

View File

@@ -31,6 +31,17 @@ public abstract class EmptyTextSettings extends SettingsPreferenceFragment {
private TextView mEmpty; private TextView mEmpty;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey);
if (usePreferenceScreenTitle()) {
final int resId = getPreferenceScreenResId();
if (resId > 0) {
addPreferencesFromResource(resId);
}
}
}
@Override @Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
@@ -47,4 +58,9 @@ public abstract class EmptyTextSettings extends SettingsPreferenceFragment {
protected void setEmptyText(int text) { protected void setEmptyText(int text) {
mEmpty.setText(text); mEmpty.setText(text);
} }
/**
* Get the res id for static preference xml for this fragment.
*/
protected abstract int getPreferenceScreenResId();
} }

View File

@@ -16,7 +16,6 @@
package com.android.settings.notification; package com.android.settings.notification;
import android.app.ActivityManager;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.Fragment; import android.app.Fragment;
@@ -38,11 +37,6 @@ public class NotificationAccessSettings extends ManagedServiceSettings {
private static final String TAG = NotificationAccessSettings.class.getSimpleName(); private static final String TAG = NotificationAccessSettings.class.getSimpleName();
private static final Config CONFIG = getNotificationListenerConfig(); private static final Config CONFIG = getNotificationListenerConfig();
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
}
private static Config getNotificationListenerConfig() { private static Config getNotificationListenerConfig() {
final Config c = new Config(); final Config c = new Config();
c.tag = TAG; c.tag = TAG;
@@ -100,6 +94,11 @@ public class NotificationAccessSettings extends ManagedServiceSettings {
mNm.setNotificationListenerAccessGranted(service, true); mNm.setNotificationListenerAccessGranted(service, true);
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.notification_access_settings;
}
@VisibleForTesting @VisibleForTesting
void logSpecialPermissionChange(boolean enable, String packageName) { void logSpecialPermissionChange(boolean enable, String packageName) {
int logCategory = enable ? MetricsEvent.APP_SPECIAL_PERMISSION_NOTIVIEW_ALLOW int logCategory = enable ? MetricsEvent.APP_SPECIAL_PERMISSION_NOTIVIEW_ALLOW

View File

@@ -21,9 +21,7 @@ import android.app.ActivityManager;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.AppGlobals; import android.app.AppGlobals;
import android.app.Dialog; import android.app.Dialog;
import android.app.DialogFragment;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
@@ -38,7 +36,6 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.RemoteException; import android.os.RemoteException;
import android.provider.Settings;
import android.provider.Settings.Secure; import android.provider.Settings.Secure;
import android.support.v14.preference.SwitchPreference; import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference; import android.support.v7.preference.Preference;
@@ -48,7 +45,6 @@ import android.text.TextUtils;
import android.util.ArraySet; import android.util.ArraySet;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Toast;
import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -80,7 +76,9 @@ public class ZenAccessSettings extends EmptyTextSettings {
mContext = getActivity(); mContext = getActivity();
mPkgMan = mContext.getPackageManager(); mPkgMan = mContext.getPackageManager();
mNoMan = mContext.getSystemService(NotificationManager.class); mNoMan = mContext.getSystemService(NotificationManager.class);
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(mContext)); if (!usePreferenceScreenTitle()) {
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(mContext));
}
} }
@Override @Override
@@ -89,6 +87,11 @@ public class ZenAccessSettings extends EmptyTextSettings {
setEmptyText(R.string.zen_access_empty_text); setEmptyText(R.string.zen_access_empty_text);
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.zen_access_settings;
}
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();

View File

@@ -57,6 +57,11 @@ public class WebViewAppPicker extends DefaultAppPickerFragment {
} }
} }
@Override
protected int getPreferenceScreenResId() {
return R.xml.webview_app_settings;
}
@Override @Override
protected List<DefaultAppInfo> getCandidates() { protected List<DefaultAppInfo> getCandidates() {
final List<DefaultAppInfo> packageInfoList = new ArrayList<DefaultAppInfo>(); final List<DefaultAppInfo> packageInfoList = new ArrayList<DefaultAppInfo>();

View File

@@ -17,9 +17,6 @@
package com.android.settings.widget; package com.android.settings.widget;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.os.UserHandle; import android.os.UserHandle;
@@ -70,7 +67,12 @@ public abstract class RadioButtonPickerFragment extends InstrumentedPreferenceFr
@Override @Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey); super.onCreatePreferences(savedInstanceState, rootKey);
addPreferencesFromResource(R.xml.placeholder_prefs); final int resId = getPreferenceScreenResId();
if (usePreferenceScreenTitle() && resId > 0) {
addPreferencesFromResource(resId);
} else {
addPreferencesFromResource(R.xml.placeholder_prefs);
}
updateCandidates(); updateCandidates();
} }
@@ -113,6 +115,13 @@ public abstract class RadioButtonPickerFragment extends InstrumentedPreferenceFr
onSelectionPerformed(success); onSelectionPerformed(success);
} }
/**
* Get the res id for static preference xml for this fragment.
*/
protected int getPreferenceScreenResId() {
return -1;
}
/** /**
* A chance for subclasses to bind additional things to the preference. * A chance for subclasses to bind additional things to the preference.
*/ */

View File

@@ -51,8 +51,8 @@ public class FeatureFlagsDashboardTest {
} }
@Test @Test
public void shouldUsePlaceholderPreferenceLayout() { public void shouldUseFeatureFlagPreferenceLayout() {
assertThat(mDashboard.getPreferenceScreenResId()) assertThat(mDashboard.getPreferenceScreenResId())
.isEqualTo(R.xml.placeholder_prefs); .isEqualTo(R.xml.feature_flags_settings);
} }
} }