Don't show separate option for erasing USB storage
On devices with emulated USB storage or SD card, factory reset will wipe all data from that area. Given that, it doesn't make sense to show a different option for wiping USB storage. Bug: 3242568 Change-Id: I257bdde06141f14381c8c09ce6a42c18d7080efd
This commit is contained in:
@@ -35,6 +35,12 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:text="@string/master_clear_desc" />
|
android:text="@string/master_clear_desc" />
|
||||||
|
<TextView android:id="@+id/also_erases_external"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:text="@string/master_clear_desc_also_erases_external" />
|
||||||
<TextView android:id="@+id/accounts_label"
|
<TextView android:id="@+id/accounts_label"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -46,7 +52,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
<TextView
|
<TextView android:id="@+id/erase_external_option_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
|
@@ -1604,6 +1604,8 @@
|
|||||||
<string name="master_clear_desc" product="default">"This will erase all data from your phone\'s <b>internal storage</b>, including:\n\n<li>Your Google account</li>\n<li>System and application data and settings</li>\n<li>Downloaded applications"</li></string>
|
<string name="master_clear_desc" product="default">"This will erase all data from your phone\'s <b>internal storage</b>, including:\n\n<li>Your Google account</li>\n<li>System and application data and settings</li>\n<li>Downloaded applications"</li></string>
|
||||||
<!-- SD card & phone storage settings screen, instructions and list of current accounts. The list of accounts follows this text[CHAR LIMIT=NONE] -->
|
<!-- SD card & phone storage settings screen, instructions and list of current accounts. The list of accounts follows this text[CHAR LIMIT=NONE] -->
|
||||||
<string name="master_clear_accounts" product="default">"\n\nYou are currently signed into the following accounts:\n"</string>
|
<string name="master_clear_accounts" product="default">"\n\nYou are currently signed into the following accounts:\n"</string>
|
||||||
|
<!-- SD card & phone storage settings screen, list of items in user data storage (USB storage or SD card) that will be erased during this operation [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="master_clear_desc_also_erases_external">"<li>Music</li>\n<li>Photos</li>\n<li>Other user data</li>"</string>
|
||||||
<!-- SD card & phone storage settings screen, instructions about whether to also erase the external storage (SD card) when erasing the internal storage [CHAR LIMIT=NONE] -->
|
<!-- SD card & phone storage settings screen, instructions about whether to also erase the external storage (SD card) when erasing the internal storage [CHAR LIMIT=NONE] -->
|
||||||
<string name="master_clear_desc_erase_external_storage" product="nosdcard">"\n\nTo also clear music, pictures, and other user data, the <b>USB storage</b> needs to be erased."</string>
|
<string name="master_clear_desc_erase_external_storage" product="nosdcard">"\n\nTo also clear music, pictures, and other user data, the <b>USB storage</b> needs to be erased."</string>
|
||||||
<!-- SD card & phone storage settings screen, instructions about whether to also erase the external storage (SD card) when erasing the internal storage [CHAR LIMIT=NONE] -->
|
<!-- SD card & phone storage settings screen, instructions about whether to also erase the external storage (SD card) when erasing the internal storage [CHAR LIMIT=NONE] -->
|
||||||
|
@@ -29,6 +29,7 @@ import android.content.pm.PackageManager;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -133,13 +134,29 @@ public class MasterClear extends Fragment {
|
|||||||
mExternalStorageContainer = mContentView.findViewById(R.id.erase_external_container);
|
mExternalStorageContainer = mContentView.findViewById(R.id.erase_external_container);
|
||||||
mExternalStorage = (CheckBox) mContentView.findViewById(R.id.erase_external);
|
mExternalStorage = (CheckBox) mContentView.findViewById(R.id.erase_external);
|
||||||
|
|
||||||
mExternalStorageContainer.setOnClickListener(new View.OnClickListener() {
|
/*
|
||||||
|
* If the external storage is emulated, it will be erased with a factory
|
||||||
|
* reset at any rate. There is no need to have a separate option until
|
||||||
|
* we have a factory reset that only erases some directories and not
|
||||||
|
* others.
|
||||||
|
*/
|
||||||
|
if (Environment.isExternalStorageEmulated()) {
|
||||||
|
mExternalStorageContainer.setVisibility(View.GONE);
|
||||||
|
|
||||||
@Override
|
final View externalOption = mContentView.findViewById(R.id.erase_external_option_text);
|
||||||
public void onClick(View v) {
|
externalOption.setVisibility(View.GONE);
|
||||||
mExternalStorage.toggle();
|
|
||||||
}
|
final View externalAlsoErased = mContentView.findViewById(R.id.also_erases_external);
|
||||||
});
|
externalAlsoErased.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
mExternalStorageContainer.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
mExternalStorage.toggle();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
loadAccountList();
|
loadAccountList();
|
||||||
}
|
}
|
||||||
|
@@ -171,9 +171,7 @@ public class Memory extends SettingsPreferenceFragment implements OnCancelListen
|
|||||||
mSdMountPreferenceGroup = (PreferenceGroup)findPreference(MEMORY_SD_GROUP);
|
mSdMountPreferenceGroup = (PreferenceGroup)findPreference(MEMORY_SD_GROUP);
|
||||||
|
|
||||||
if (Environment.isExternalStorageEmulated()) {
|
if (Environment.isExternalStorageEmulated()) {
|
||||||
mSdMountPreferenceGroup.removePreference(mSdSize);
|
getPreferenceScreen().removePreference(mSdMountPreferenceGroup);
|
||||||
mSdMountPreferenceGroup.removePreference(mSdAvail);
|
|
||||||
mSdMountPreferenceGroup.removePreference(mSdMountToggle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mInternalSize = findPreference(MEMORY_INTERNAL_SIZE);
|
mInternalSize = findPreference(MEMORY_INTERNAL_SIZE);
|
||||||
|
Reference in New Issue
Block a user