Loading res/xml/reset_dashboard_fragment.xml 0 → 100644 +43 −0 Original line number Diff line number Diff line <?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" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" android:title="@string/reset_dashboard_title"> <!-- Network reset --> <Preference android:key="network_reset_pref" android:title="@string/reset_network_title" android:fragment="com.android.settings.ResetNetwork" /> <!-- Reset app preferences --> <Preference android:key="reset_app_prefs" android:title="@string/reset_app_preferences" /> <!-- Factory reset --> <com.android.settingslib.RestrictedPreference android:key="factory_reset" android:title="@string/master_clear_title" android:summary="@string/master_clear_summary" settings:keywords="@string/keywords_factory_data_reset" settings:userRestriction="no_factory_reset" settings:useAdminDisabledSummary="true" android:fragment="com.android.settings.MasterClear" /> </PreferenceScreen> res/xml/system_dashboard_fragment.xml +7 −11 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" android:title="@string/header_category_system"> <!-- System updates --> Loading @@ -38,14 +37,11 @@ android:targetClass="@string/additional_system_update_menu" /> </Preference> <!-- Factory reset --> <com.android.settingslib.RestrictedPreference android:key="factory_reset" android:title="@string/master_clear_title" <Preference android:key="reset_dashboard" android:title="@string/reset_dashboard_title" android:icon="@drawable/ic_restore" android:order="-20" settings:keywords="@string/keywords_factory_data_reset" settings:userRestriction="no_factory_reset" settings:useAdminDisabledSummary="true" android:fragment="com.android.settings.MasterClear" /> android:fragment="com.android.settings.system.ResetDashboardFragment" /> </PreferenceScreen> No newline at end of file src/com/android/settings/applications/ResetAppPrefPreferenceController.java 0 → 100644 +71 −0 Original line number Diff line number Diff line /* * 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. */ package com.android.settings.applications; import android.content.Context; import android.os.Bundle; import android.support.v7.preference.Preference; import android.text.TextUtils; import com.android.settings.core.PreferenceController; import com.android.settings.core.lifecycle.Lifecycle; import com.android.settings.core.lifecycle.LifecycleObserver; import com.android.settings.core.lifecycle.events.OnCreate; import com.android.settings.core.lifecycle.events.OnSaveInstanceState; public class ResetAppPrefPreferenceController extends PreferenceController implements LifecycleObserver, OnCreate, OnSaveInstanceState { private ResetAppsHelper mResetAppsHelper; public ResetAppPrefPreferenceController(Context context, Lifecycle lifecycle) { super(context); mResetAppsHelper = new ResetAppsHelper(context); if (lifecycle != null) { lifecycle.addObserver(this); } } @Override public boolean handlePreferenceTreeClick(Preference preference) { if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) { return false; } mResetAppsHelper.buildResetDialog(); return true; } @Override public boolean isAvailable() { return true; } @Override public String getPreferenceKey() { return "reset_app_prefs"; } @Override public void onCreate(Bundle savedInstanceState) { mResetAppsHelper.onRestoreInstanceState(savedInstanceState); } @Override public void onSaveInstanceState(Bundle outState) { mResetAppsHelper.onSaveInstanceState(outState); } } src/com/android/settings/applications/ResetAppsHelper.java +3 −3 Original line number Diff line number Diff line Loading @@ -15,6 +15,9 @@ */ package com.android.settings.applications; import static android.net.NetworkPolicyManager.POLICY_NONE; import static android.net.NetworkPolicyManager.POLICY_REJECT_METERED_BACKGROUND; import android.app.ActivityManager; import android.app.AlertDialog; import android.app.AppOpsManager; Loading @@ -36,9 +39,6 @@ import com.android.settings.R; import java.util.List; import static android.net.NetworkPolicyManager.POLICY_NONE; import static android.net.NetworkPolicyManager.POLICY_REJECT_METERED_BACKGROUND; public class ResetAppsHelper implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener { Loading src/com/android/settings/core/gateway/SettingsGateway.java +2 −0 Original line number Diff line number Diff line Loading @@ -113,6 +113,7 @@ import com.android.settings.print.PrintJobSettingsFragment; import com.android.settings.print.PrintSettingsFragment; import com.android.settings.security.LockscreenDashboardFragment; import com.android.settings.sim.SimSettings; import com.android.settings.system.ResetDashboardFragment; import com.android.settings.system.SystemDashboardFragment; import com.android.settings.tts.TextToSpeechSettings; import com.android.settings.users.UserSettings; Loading Loading @@ -231,6 +232,7 @@ public class SettingsGateway { WifiAPITest.class.getName(), WifiInfo.class.getName(), MasterClear.class.getName(), ResetDashboardFragment.class.getName(), NightDisplaySettings.class.getName(), ManageDomainUrls.class.getName(), AutomaticStorageManagerSettings.class.getName(), Loading Loading
res/xml/reset_dashboard_fragment.xml 0 → 100644 +43 −0 Original line number Diff line number Diff line <?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" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" android:title="@string/reset_dashboard_title"> <!-- Network reset --> <Preference android:key="network_reset_pref" android:title="@string/reset_network_title" android:fragment="com.android.settings.ResetNetwork" /> <!-- Reset app preferences --> <Preference android:key="reset_app_prefs" android:title="@string/reset_app_preferences" /> <!-- Factory reset --> <com.android.settingslib.RestrictedPreference android:key="factory_reset" android:title="@string/master_clear_title" android:summary="@string/master_clear_summary" settings:keywords="@string/keywords_factory_data_reset" settings:userRestriction="no_factory_reset" settings:useAdminDisabledSummary="true" android:fragment="com.android.settings.MasterClear" /> </PreferenceScreen>
res/xml/system_dashboard_fragment.xml +7 −11 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" android:title="@string/header_category_system"> <!-- System updates --> Loading @@ -38,14 +37,11 @@ android:targetClass="@string/additional_system_update_menu" /> </Preference> <!-- Factory reset --> <com.android.settingslib.RestrictedPreference android:key="factory_reset" android:title="@string/master_clear_title" <Preference android:key="reset_dashboard" android:title="@string/reset_dashboard_title" android:icon="@drawable/ic_restore" android:order="-20" settings:keywords="@string/keywords_factory_data_reset" settings:userRestriction="no_factory_reset" settings:useAdminDisabledSummary="true" android:fragment="com.android.settings.MasterClear" /> android:fragment="com.android.settings.system.ResetDashboardFragment" /> </PreferenceScreen> No newline at end of file
src/com/android/settings/applications/ResetAppPrefPreferenceController.java 0 → 100644 +71 −0 Original line number Diff line number Diff line /* * 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. */ package com.android.settings.applications; import android.content.Context; import android.os.Bundle; import android.support.v7.preference.Preference; import android.text.TextUtils; import com.android.settings.core.PreferenceController; import com.android.settings.core.lifecycle.Lifecycle; import com.android.settings.core.lifecycle.LifecycleObserver; import com.android.settings.core.lifecycle.events.OnCreate; import com.android.settings.core.lifecycle.events.OnSaveInstanceState; public class ResetAppPrefPreferenceController extends PreferenceController implements LifecycleObserver, OnCreate, OnSaveInstanceState { private ResetAppsHelper mResetAppsHelper; public ResetAppPrefPreferenceController(Context context, Lifecycle lifecycle) { super(context); mResetAppsHelper = new ResetAppsHelper(context); if (lifecycle != null) { lifecycle.addObserver(this); } } @Override public boolean handlePreferenceTreeClick(Preference preference) { if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) { return false; } mResetAppsHelper.buildResetDialog(); return true; } @Override public boolean isAvailable() { return true; } @Override public String getPreferenceKey() { return "reset_app_prefs"; } @Override public void onCreate(Bundle savedInstanceState) { mResetAppsHelper.onRestoreInstanceState(savedInstanceState); } @Override public void onSaveInstanceState(Bundle outState) { mResetAppsHelper.onSaveInstanceState(outState); } }
src/com/android/settings/applications/ResetAppsHelper.java +3 −3 Original line number Diff line number Diff line Loading @@ -15,6 +15,9 @@ */ package com.android.settings.applications; import static android.net.NetworkPolicyManager.POLICY_NONE; import static android.net.NetworkPolicyManager.POLICY_REJECT_METERED_BACKGROUND; import android.app.ActivityManager; import android.app.AlertDialog; import android.app.AppOpsManager; Loading @@ -36,9 +39,6 @@ import com.android.settings.R; import java.util.List; import static android.net.NetworkPolicyManager.POLICY_NONE; import static android.net.NetworkPolicyManager.POLICY_REJECT_METERED_BACKGROUND; public class ResetAppsHelper implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener { Loading
src/com/android/settings/core/gateway/SettingsGateway.java +2 −0 Original line number Diff line number Diff line Loading @@ -113,6 +113,7 @@ import com.android.settings.print.PrintJobSettingsFragment; import com.android.settings.print.PrintSettingsFragment; import com.android.settings.security.LockscreenDashboardFragment; import com.android.settings.sim.SimSettings; import com.android.settings.system.ResetDashboardFragment; import com.android.settings.system.SystemDashboardFragment; import com.android.settings.tts.TextToSpeechSettings; import com.android.settings.users.UserSettings; Loading Loading @@ -231,6 +232,7 @@ public class SettingsGateway { WifiAPITest.class.getName(), WifiInfo.class.getName(), MasterClear.class.getName(), ResetDashboardFragment.class.getName(), NightDisplaySettings.class.getName(), ManageDomainUrls.class.getName(), AutomaticStorageManagerSettings.class.getName(), Loading