MainClear: remove obsolete check for multi-volume FDE

It is never the case that '!isExternalStorageEmulated() &&
!isExternalStorageRemovable() && isExtStorageEncrypted()', so stop
checking for this.

It's easy to see that even just the last part, isExtStorageEncrypted(),
is never true, since it checks whether the property "vold.decrypt" is
non-empty.  That system property was only set on devices that used FDE
(Full Disk Encryption), and FDE support was removed in Android T.

Moreover, the full condition of '!emulated && !removable && FDE'
actually checked for devices that used multi-volume FDE, which
apparently was never actually used, and was removed 8 years ago by vold
commit 87999173dd79 (http://ag/423222).  This is consistent with the
fact that this code was added 11 years ago by commit 2a32192329
(http://ag/134210), when probably this feature was still planned.

Bug: 208476087
Change-Id: I4c2b5c9aed8812367a70d0dd1bbcc94008fec529
This commit is contained in:
Eric Biggers
2022-04-25 21:27:03 +00:00
parent 316b8ad6c9
commit 8c25415736

View File

@@ -44,7 +44,6 @@ import android.os.SystemProperties;
import android.os.UserHandle; import android.os.UserHandle;
import android.os.UserManager; import android.os.UserManager;
import android.provider.Settings; import android.provider.Settings;
import android.sysprop.VoldProperties;
import android.telephony.euicc.EuiccManager; import android.telephony.euicc.EuiccManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@@ -309,12 +308,9 @@ public class MainClear extends InstrumentedFragment implements OnGlobalLayoutLis
* If the external storage is emulated, it will be erased with a factory * 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 * 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 * we have a factory reset that only erases some directories and not
* others. Likewise, if it's non-removable storage, it could potentially have been * others.
* encrypted, and will also need to be wiped.
*/ */
boolean isExtStorageEmulated = Environment.isExternalStorageEmulated(); if (Environment.isExternalStorageEmulated()) {
if (isExtStorageEmulated
|| (!Environment.isExternalStorageRemovable() && isExtStorageEncrypted())) {
mExternalStorageContainer.setVisibility(View.GONE); mExternalStorageContainer.setVisibility(View.GONE);
final View externalOption = mContentView.findViewById(R.id.erase_external_option_text); final View externalOption = mContentView.findViewById(R.id.erase_external_option_text);
@@ -323,9 +319,7 @@ public class MainClear extends InstrumentedFragment implements OnGlobalLayoutLis
final View externalAlsoErased = mContentView.findViewById(R.id.also_erases_external); final View externalAlsoErased = mContentView.findViewById(R.id.also_erases_external);
externalAlsoErased.setVisibility(View.VISIBLE); externalAlsoErased.setVisibility(View.VISIBLE);
// If it's not emulated, it is on a separate partition but it means we're doing mExternalStorage.setChecked(false);
// a force wipe due to encryption.
mExternalStorage.setChecked(!isExtStorageEmulated);
} else { } else {
mExternalStorageContainer.setOnClickListener(new View.OnClickListener() { mExternalStorageContainer.setOnClickListener(new View.OnClickListener() {
@@ -457,11 +451,6 @@ public class MainClear extends InstrumentedFragment implements OnGlobalLayoutLis
} }
} }
private boolean isExtStorageEncrypted() {
String state = VoldProperties.decrypt().orElse("");
return !"".equals(state);
}
private void loadAccountList(final UserManager um) { private void loadAccountList(final UserManager um) {
View accountsLabel = mContentView.findViewById(R.id.accounts_label); View accountsLabel = mContentView.findViewById(R.id.accounts_label);
LinearLayout contents = (LinearLayout) mContentView.findViewById(R.id.accounts); LinearLayout contents = (LinearLayout) mContentView.findViewById(R.id.accounts);