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 android:name="SetFullBackupPassword"
android:label="@string/local_backup_password_title"
android:exported="false">
</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.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/data_usage_summary_title">
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/data_usage_app_summary_title">
<com.android.settings.datausage.SpinnerPreference
android:key="cycle" />

View File

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

View File

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

View File

@@ -16,7 +16,7 @@
-->
<PreferenceScreen
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
android:key="bluetooth_device_header"

View File

@@ -16,7 +16,7 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/bluetooth_settings">
android:title="@string/bluetooth_pairing_pref_title">
<Preference
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.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/data_usage_summary_title">
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:key="usage_amount">

View File

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

@@ -4,9 +4,9 @@
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.
@@ -14,7 +14,9 @@
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>

View File

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

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
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/app_memory_use">
android:title="@string/memory_usage_apps">
<PreferenceCategory
android:key="app_list"

View File

@@ -14,8 +14,10 @@
limitations under the License.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto">
<PreferenceScreen
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
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"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:title="@string/vpn_title">
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<Preference
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"
android:title="@string/wifi_saved_access_points_titlebar">
android:title="@string/wifi_display_settings_title">
</PreferenceScreen>

View File

@@ -14,7 +14,9 @@
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
android:key="p2p_this_device"
android:selectable="false" />

View File

@@ -15,7 +15,9 @@
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
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 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.VisibilityLoggerMixin;
@@ -136,6 +137,9 @@ public class DeviceAdminSettings extends ListFragment implements Instrumentable
super.onActivityCreated(savedInstanceState);
setHasOptionsMenu(true);
Utils.forceCustomPadding(getListView(), true /* additive padding */);
if (InstrumentedPreferenceFragment.usePreferenceScreenTitle()) {
getActivity().setTitle(R.string.manage_device_admin);
}
}
@Override

View File

@@ -21,6 +21,7 @@ import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AuthenticatorDescription;
import android.annotation.StringRes;
import android.app.Activity;
import android.content.ComponentName;
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}
* component as a subactivity

View File

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

View File

@@ -65,6 +65,9 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
super.onActivityCreated(savedInstanceState);
final SettingsActivity activity = (SettingsActivity) getActivity();
if (usePreferenceScreenTitle()) {
activity.setTitle(R.string.screen_pinning_title);
}
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 android.animation.LayoutTransition;
import android.annotation.StringRes;
import android.annotation.UiThread;
import android.app.Activity;
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 int REQUEST_CONFIRM_CREDENTIALS = 1;
@Override
@StringRes
protected int getTitle() {
return R.string.trusted_credentials;
}
@Override
public int getMetricsCategory() {
return MetricsEvent.TRUSTED_CREDENTIALS;

View File

@@ -18,6 +18,7 @@ package com.android.settings;
import android.annotation.LayoutRes;
import android.annotation.Nullable;
import android.annotation.StringRes;
import android.app.AlertDialog;
import android.app.Dialog;
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) {
if (!isAdded()) {
return;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -17,6 +17,7 @@
package com.android.settings.accessibility;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
@@ -49,9 +50,14 @@ public abstract class ToggleFeaturePreferenceFragment
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(
getActivity());
setPreferenceScreen(preferenceScreen);
final int resId = getPreferenceScreenResId();
if (usePreferenceScreenTitle() && resId > 0) {
addPreferencesFromResource(resId);
} else {
PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(
getActivity());
setPreferenceScreen(preferenceScreen);
}
}
@Override
@@ -98,6 +104,13 @@ public abstract class ToggleFeaturePreferenceFragment
// 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() {
mSwitchBar.show();
onInstallSwitchBarToggleSwitch();
@@ -124,7 +137,11 @@ public abstract class ToggleFeaturePreferenceFragment
}
// 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));
}

View File

@@ -17,6 +17,7 @@
package com.android.settings.accessibility;
import android.annotation.Nullable;
import android.annotation.StringRes;
import android.content.ContentResolver;
import android.content.res.Configuration;
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
protected Configuration createConfig(Configuration origConfig, int index) {
// Populate the sample layouts.

View File

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

View File

@@ -15,6 +15,7 @@
*/
package com.android.settings.applications;
import android.annotation.Nullable;
import android.app.Activity;
import android.content.Intent;
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.SettingsActivity;
import com.android.settings.core.InstrumentedFragment;
import com.android.settings.core.InstrumentedPreferenceFragment;
import com.android.settings.password.ChooseLockSettingsHelper;
/* 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));
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (InstrumentedPreferenceFragment.usePreferenceScreenTitle()) {
getActivity().setTitle(R.string.convert_to_file_encryption);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
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);
}
public static void startAppInfoFragment(Class<?> fragment, CharSequence title,
public static void startAppInfoFragment(Class<?> fragment, int title,
SettingsPreferenceFragment caller, AppEntry appEntry) {
// start new fragment to display extended information
Bundle args = new Bundle();
@@ -942,7 +942,7 @@ public class InstalledAppDetails extends AppInfoBase
args.putInt(ARG_PACKAGE_UID, appEntry.info.uid);
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);
}
@@ -1018,19 +1018,18 @@ public class InstalledAppDetails extends AppInfoBase
@Override
public boolean onPreferenceClick(Preference preference) {
if (preference == mStoragePreference) {
startAppInfoFragment(AppStorageSettings.class, mStoragePreference.getTitle());
startAppInfoFragment(AppStorageSettings.class, R.string.storage_settings);
} else if (preference == mNotificationPreference) {
startAppInfoFragment(AppNotificationSettings.class,
getString(R.string.app_notifications_title));
startAppInfoFragment(AppNotificationSettings.class, R.string.app_notifications_title);
} else if (preference == mPermissionsPreference) {
startManagePermissionsActivity();
} else if (preference == mLaunchPreference) {
startAppInfoFragment(AppLaunchSettings.class, mLaunchPreference.getTitle());
startAppInfoFragment(AppLaunchSettings.class, R.string.launch_by_default);
} else if (preference == mMemoryPreference) {
ProcessStatsBase.launchMemoryDetail((SettingsActivity) getActivity(),
mStatsManager.getMemInfo(), mStats, false);
} 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) {
if (isBatteryStatsAvailable()) {
BatteryEntry entry = new BatteryEntry(getContext(), null, mUserManager, mSipper);
@@ -1109,8 +1108,7 @@ public class InstalledAppDetails extends AppInfoBase
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
startAppInfoFragment(DrawOverlayDetails.class,
getString(R.string.draw_overlay));
startAppInfoFragment(DrawOverlayDetails.class, R.string.draw_overlay);
return true;
}
});
@@ -1123,8 +1121,7 @@ public class InstalledAppDetails extends AppInfoBase
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
startAppInfoFragment(WriteSettingsDetails.class,
getString(R.string.write_settings));
startAppInfoFragment(WriteSettingsDetails.class, R.string.write_settings);
return true;
}
});
@@ -1154,7 +1151,7 @@ public class InstalledAppDetails extends AppInfoBase
@Override
public boolean onPreferenceClick(Preference preference) {
startAppInfoFragment(ExternalSourcesDetails.class,
getString(R.string.install_other_apps));
R.string.install_other_apps);
return true;
}
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -24,6 +24,7 @@ import android.text.TextUtils;
import com.android.internal.app.AssistUtils;
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.DefaultAppPickerFragment;
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
protected List<VoiceInputDefaultAppInfo> getCandidates() {
final List<VoiceInputDefaultAppInfo> candidates = new ArrayList<>();

View File

@@ -18,9 +18,7 @@ package com.android.settings.applications.defaultapps;
import android.Manifest;
import android.app.Activity;
import android.app.Dialog;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -30,7 +28,6 @@ import android.content.pm.ServiceInfo;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.service.autofill.AutofillService;
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
public int getMetricsCategory() {
return MetricsProto.MetricsEvent.DEFAULT_AUTOFILL_PICKER;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -223,10 +223,13 @@ public class ManageApplications extends InstrumentedPreferenceFragment
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
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();
int screenTitle = intent.getIntExtra(
SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RESID, R.string.notifications_label);
String className = args != null ? args.getString(EXTRA_CLASSNAME) : null;
if (className == null) {
className = intent.getComponent().getClassName();
@@ -235,6 +238,7 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|| this instanceof NotificationApps) {
mListType = LIST_TYPE_NOTIFICATION;
mNotifBackend = new NotificationBackend();
screenTitle = R.string.app_notifications_title;
} else if (className.equals(StorageUseActivity.class.getName())) {
if (args != null && args.containsKey(EXTRA_VOLUME_UUID)) {
mVolumeUuid = args.getString(EXTRA_VOLUME_UUID);
@@ -247,16 +251,21 @@ public class ManageApplications extends InstrumentedPreferenceFragment
mSortOrder = R.id.sort_order_size;
} else if (className.equals(UsageAccessSettingsActivity.class.getName())) {
mListType = LIST_TYPE_USAGE_ACCESS;
screenTitle = R.string.usage_access;
} else if (className.equals(HighPowerApplicationsActivity.class.getName())) {
mListType = LIST_TYPE_HIGH_POWER;
// Default to showing system.
mShowSystem = true;
screenTitle = R.string.high_power_apps;
} else if (className.equals(OverlaySettingsActivity.class.getName())) {
mListType = LIST_TYPE_OVERLAY;
screenTitle = R.string.system_alert_window_settings;
} else if (className.equals(WriteSettingsActivity.class.getName())) {
mListType = LIST_TYPE_WRITE_SETTINGS;
screenTitle = R.string.write_settings;
} else if (className.equals(ManageExternalSourcesActivity.class.getName())) {
mListType = LIST_TYPE_MANAGE_SOURCES;
screenTitle = R.string.install_other_apps;
} else if (className.equals(GamesStorageActivity.class.getName())) {
mListType = LIST_TYPE_GAMES;
mSortOrder = R.id.sort_order_size;
@@ -280,9 +289,13 @@ public class ManageApplications extends InstrumentedPreferenceFragment
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

View File

@@ -16,23 +16,36 @@ package com.android.settings.datausage;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.net.NetworkTemplate;
import android.os.Bundle;
import android.support.v4.content.res.TypedArrayUtils;
import android.support.v7.preference.Preference;
import android.text.format.Formatter;
import android.util.AttributeSet;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.core.InstrumentedPreferenceFragment;
import com.android.settingslib.net.DataUsageController;
public class DataUsagePreference extends Preference implements TemplatePreference {
private NetworkTemplate mTemplate;
private int mSubId;
private int mTitleRes;
public DataUsagePreference(Context context, AttributeSet 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
@@ -52,6 +65,11 @@ public class DataUsagePreference extends Preference implements TemplatePreferenc
Bundle args = new Bundle();
args.putParcelable(DataUsageList.EXTRA_NETWORK_TEMPLATE, mTemplate);
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,
getContext().getPackageName(), 0, getTitle(), false,
MetricsProto.MetricsEvent.VIEW_UNKNOWN);

View File

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

View File

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

View File

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

View File

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

View File

@@ -17,6 +17,7 @@
package com.android.settings.display;
import android.annotation.Nullable;
import android.annotation.StringRes;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
@@ -98,6 +99,12 @@ public class ScreenZoomSettings extends PreviewSeekBarPreferenceFragment impleme
return R.string.help_url_display_size;
}
@Override
@StringRes
protected int getTitle() {
return R.string.screen_zoom_title;
}
@Override
public int getMetricsCategory() {
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_";
@Override
protected int getPreferenceScreenResId() {
return R.xml.vr_display_settings;
}
@Override
public int getMetricsCategory() {
return MetricsProto.MetricsEvent.VR_DISPLAY_PREFERENCE;

View File

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

View File

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

View File

@@ -16,6 +16,7 @@
package com.android.settings.nfc;
import android.annotation.StringRes;
import android.nfc.NfcAdapter;
import android.os.Bundle;
import android.os.UserHandle;
@@ -130,4 +131,10 @@ public class AndroidBeam extends InstrumentedPreferenceFragment
public int getMetricsCategory() {
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());
setHasOptionsMenu(true);
PreferenceManager manager = getPreferenceManager();
PreferenceScreen screen = manager.createPreferenceScreen(getActivity());
final PreferenceScreen screen;
if (usePreferenceScreenTitle()) {
addPreferencesFromResource(R.xml.nfc_payment_settings);
screen = getPreferenceScreen();
} else {
PreferenceManager manager = getPreferenceManager();
screen = manager.createPreferenceScreen(getActivity());
}
List<PaymentBackend.PaymentAppInfo> appInfos = mPaymentBackend.getPaymentAppInfos();
if (appInfos != null && appInfos.size() > 0) {
@@ -71,7 +77,9 @@ public class PaymentSettings extends SettingsPreferenceFragment implements Index
mPaymentBackend);
screen.addPreference(foreground);
}
setPreferenceScreen(screen);
if (!usePreferenceScreenTitle()) {
setPreferenceScreen(screen);
}
}
@Override

View File

@@ -31,6 +31,17 @@ public abstract class EmptyTextSettings extends SettingsPreferenceFragment {
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
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
@@ -47,4 +58,9 @@ public abstract class EmptyTextSettings extends SettingsPreferenceFragment {
protected void setEmptyText(int 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;
import android.app.ActivityManager;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.Fragment;
@@ -38,11 +37,6 @@ public class NotificationAccessSettings extends ManagedServiceSettings {
private static final String TAG = NotificationAccessSettings.class.getSimpleName();
private static final Config CONFIG = getNotificationListenerConfig();
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
}
private static Config getNotificationListenerConfig() {
final Config c = new Config();
c.tag = TAG;
@@ -100,6 +94,11 @@ public class NotificationAccessSettings extends ManagedServiceSettings {
mNm.setNotificationListenerAccessGranted(service, true);
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.notification_access_settings;
}
@VisibleForTesting
void logSpecialPermissionChange(boolean enable, String packageName) {
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.AppGlobals;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.NotificationManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.ApplicationInfo;
@@ -38,7 +36,6 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;
import android.provider.Settings;
import android.provider.Settings.Secure;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
@@ -48,7 +45,6 @@ import android.text.TextUtils;
import android.util.ArraySet;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -80,7 +76,9 @@ public class ZenAccessSettings extends EmptyTextSettings {
mContext = getActivity();
mPkgMan = mContext.getPackageManager();
mNoMan = mContext.getSystemService(NotificationManager.class);
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(mContext));
if (!usePreferenceScreenTitle()) {
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(mContext));
}
}
@Override
@@ -89,6 +87,11 @@ public class ZenAccessSettings extends EmptyTextSettings {
setEmptyText(R.string.zen_access_empty_text);
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.zen_access_settings;
}
@Override
public void 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
protected List<DefaultAppInfo> getCandidates() {
final List<DefaultAppInfo> packageInfoList = new ArrayList<DefaultAppInfo>();

View File

@@ -17,9 +17,6 @@
package com.android.settings.widget;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.UserHandle;
@@ -70,7 +67,12 @@ public abstract class RadioButtonPickerFragment extends InstrumentedPreferenceFr
@Override
public void onCreatePreferences(Bundle savedInstanceState, String 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();
}
@@ -113,6 +115,13 @@ public abstract class RadioButtonPickerFragment extends InstrumentedPreferenceFr
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.
*/

View File

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