Add an upsell dialog to activate the storage manager.
After a manual clear, the user will be prompted to turn on the storage manager, if it is turned off. The prompt will only show up after certain defined delay times and stop showing up entirely if denied enough times. Currently, the dialog does not actually turn on the storage manager because the storage manager is not yet landed. Bug: 28801159 Change-Id: I3c221786d08a7102b3b5357416ab12692d1894cf
This commit is contained in:
@@ -60,6 +60,7 @@ import com.android.settings.Utils;
|
||||
import com.android.settings.applications.ManageApplications;
|
||||
import com.android.settings.deletionhelper.DeletionHelperFragment;
|
||||
import com.android.settings.deletionhelper.AutomaticStorageManagerSettings;
|
||||
import com.android.settings.deletionhelper.StorageManagerUpsellDialog;
|
||||
import com.android.settings.deviceinfo.StorageSettings.MountTask;
|
||||
import com.android.settingslib.deviceinfo.StorageMeasurement;
|
||||
import com.android.settingslib.deviceinfo.StorageMeasurement.MeasurementDetails;
|
||||
@@ -100,6 +101,9 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
|
||||
R.string.storage_detail_other
|
||||
};
|
||||
|
||||
private static final int DELETION_HELPER_SETTINGS = 1;
|
||||
private static final int DELETION_HELPER_CLEAR = 1;
|
||||
|
||||
private StorageManager mStorageManager;
|
||||
private UserManager mUserManager;
|
||||
|
||||
@@ -418,7 +422,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
|
||||
return true;
|
||||
case R.id.storage_free:
|
||||
startFragment(this, DeletionHelperFragment.class.getCanonicalName(),
|
||||
R.string.deletion_helper_title, 0, args);
|
||||
R.string.deletion_helper_title, DELETION_HELPER_SETTINGS, args);
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
@@ -507,6 +511,18 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
|
||||
return super.onPreferenceTreeClick(pref);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == DELETION_HELPER_SETTINGS && resultCode == DELETION_HELPER_CLEAR &&
|
||||
StorageManagerUpsellDialog.shouldShow(getActivity())) {
|
||||
long freedBytes = data.getLongExtra(DeletionHelperFragment.FREED_BYTES_KEY, 0);
|
||||
StorageManagerUpsellDialog dialog =
|
||||
StorageManagerUpsellDialog.newInstance(freedBytes);
|
||||
dialog.show(getFragmentManager(), StorageManagerUpsellDialog.TAG);
|
||||
}
|
||||
}
|
||||
|
||||
private final MeasurementReceiver mReceiver = new MeasurementReceiver() {
|
||||
@Override
|
||||
public void onDetailsChanged(MeasurementDetails details) {
|
||||
|
Reference in New Issue
Block a user