resolve merge conflicts of a4e3842
to master
Change-Id: Ia52171f3cfa0bcb73c6a4d23122ef8ad9025e807
This commit is contained in:
@@ -7903,4 +7903,7 @@
|
||||
|
||||
<!-- Section title for the Domain URL app preference list [CHAR LIMIT=60]-->
|
||||
<string name="domain_url_section_title">Installed apps</string>
|
||||
|
||||
<!-- Warning when activating the automatic storage manager on legacy devices. [CHAR LIMIT=NONE] -->
|
||||
<string name="automatic_storage_manager_activation_warning">Your storage is now being managed by the storage manager</string>
|
||||
</resources>
|
||||
|
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.deletionhelper;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import com.android.settings.R;
|
||||
|
||||
/**
|
||||
* Fragment to warn the user about activating the storage manager.
|
||||
*/
|
||||
public class ActivationWarningFragment extends DialogFragment {
|
||||
public static final String TAG = "ActivationWarningFragment";
|
||||
|
||||
public static ActivationWarningFragment newInstance() {
|
||||
return new ActivationWarningFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
.setMessage(R.string.automatic_storage_manager_activation_warning)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.create();
|
||||
}
|
||||
|
||||
}
|
@@ -17,9 +17,11 @@
|
||||
package com.android.settings.deletionhelper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.provider.Settings;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
@@ -47,6 +49,8 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment
|
||||
private static final String KEY_STORAGE_MANAGER_SWITCH = "storage_manager_active";
|
||||
private static final String KEY_DOWNLOADS_BACKUP_SWITCH = "downloads_backup_active";
|
||||
private static final String KEY_DOWNLOADS_DAYS = "downloads_days";
|
||||
private static final String STORAGE_MANAGER_ENABLED_BY_DEFAULT_PROPERTY =
|
||||
"ro.storage_manager.enabled";
|
||||
|
||||
private DropDownPreference mDaysToRetain;
|
||||
private DropDownPreference mDownloadsDaysToRetain;
|
||||
@@ -138,6 +142,10 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment
|
||||
Settings.Secure.putInt(getContentResolver(),
|
||||
Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED,
|
||||
storageManagerChecked ? 1 : 0);
|
||||
// Only show a warning if enabling.
|
||||
if (storageManagerChecked) {
|
||||
maybeShowWarning();
|
||||
}
|
||||
break;
|
||||
case KEY_DOWNLOADS_BACKUP_SWITCH:
|
||||
boolean downloadsBackupChecked = (boolean) newValue;
|
||||
@@ -186,4 +194,15 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment
|
||||
}
|
||||
return indices.length - 1;
|
||||
}
|
||||
|
||||
private void maybeShowWarning() {
|
||||
// If the storage manager is on by default, we can use the normal message.
|
||||
boolean warningUnneeded = SystemProperties.getBoolean(
|
||||
STORAGE_MANAGER_ENABLED_BY_DEFAULT_PROPERTY, false);
|
||||
if (warningUnneeded) {
|
||||
return;
|
||||
}
|
||||
ActivationWarningFragment fragment = ActivationWarningFragment.newInstance();
|
||||
fragment.show(getFragmentManager(), ActivationWarningFragment.TAG);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user