DO NOT MERGE - Merge build QP1A.190711.019 into stage-aosp-master
Bug: 139893257 Change-Id: I54b340294458df6016b7893838e1b0f6e61daf11
This commit is contained in:
@@ -182,8 +182,7 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
|
||||
void showFinalConfirmation() {
|
||||
final Bundle args = new Bundle();
|
||||
args.putBoolean(ERASE_EXTERNAL_EXTRA, mExternalStorage.isChecked());
|
||||
args.putBoolean(ERASE_ESIMS_EXTRA,
|
||||
mEsimStorageContainer.getVisibility() == View.VISIBLE && mEsimStorage.isChecked());
|
||||
args.putBoolean(ERASE_ESIMS_EXTRA, mEsimStorage.isChecked());
|
||||
new SubSettingLauncher(getContext())
|
||||
.setDestination(MasterClearConfirm.class.getName())
|
||||
.setArguments(args)
|
||||
|
@@ -119,7 +119,8 @@ public class RegulatoryInfoDisplayActivity extends Activity implements
|
||||
}
|
||||
}
|
||||
|
||||
private int getResourceId() {
|
||||
@VisibleForTesting
|
||||
int getResourceId() {
|
||||
// Use regulatory_info by default.
|
||||
int resId = getResources().getIdentifier(
|
||||
REGULATORY_INFO_RESOURCE, "drawable", getPackageName());
|
||||
@@ -134,6 +135,18 @@ public class RegulatoryInfoDisplayActivity extends Activity implements
|
||||
resId = id;
|
||||
}
|
||||
}
|
||||
|
||||
// When hardware coo property exists, use regulatory_info_<sku>_<coo> resource if valid.
|
||||
final String coo = getCoo();
|
||||
if (!TextUtils.isEmpty(coo) && !TextUtils.isEmpty(sku)) {
|
||||
final String regulatory_info_coo_res =
|
||||
REGULATORY_INFO_RESOURCE + "_" + sku.toLowerCase() + "_" + coo.toLowerCase();
|
||||
final int id = getResources().getIdentifier(
|
||||
regulatory_info_coo_res, "drawable", getPackageName());
|
||||
if (id != 0) {
|
||||
resId = id;
|
||||
}
|
||||
}
|
||||
return resId;
|
||||
}
|
||||
|
||||
@@ -142,13 +155,15 @@ public class RegulatoryInfoDisplayActivity extends Activity implements
|
||||
finish(); // close the activity
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public static String getSku() {
|
||||
private String getCoo() {
|
||||
return SystemProperties.get("ro.boot.hardware.coo", "");
|
||||
}
|
||||
|
||||
private String getSku() {
|
||||
return SystemProperties.get("ro.boot.hardware.sku", "");
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public static String getRegulatoryInfoImageFileName() {
|
||||
private String getRegulatoryInfoImageFileName() {
|
||||
final String sku = getSku();
|
||||
if (TextUtils.isEmpty(sku)) {
|
||||
return DEFAULT_REGULATORY_INFO_FILEPATH;
|
||||
|
@@ -20,10 +20,13 @@ import android.content.Context;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.text.format.Formatter;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settingslib.deviceinfo.PrivateStorageInfo;
|
||||
import com.android.settingslib.deviceinfo.StorageManagerVolumeProvider;
|
||||
import com.android.settingslib.utils.ThreadUtils;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
|
||||
@@ -44,14 +47,22 @@ public class TopLevelStoragePreferenceController extends BasePreferenceControlle
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getSummary() {
|
||||
// TODO: Register listener.
|
||||
final NumberFormat percentageFormat = NumberFormat.getPercentInstance();
|
||||
final PrivateStorageInfo info = PrivateStorageInfo.getPrivateStorageInfo(
|
||||
mStorageManagerVolumeProvider);
|
||||
double privateUsedBytes = info.totalBytes - info.freeBytes;
|
||||
return mContext.getString(R.string.storage_summary,
|
||||
percentageFormat.format(privateUsedBytes / info.totalBytes),
|
||||
Formatter.formatFileSize(mContext, info.freeBytes));
|
||||
protected void refreshSummary(Preference preference) {
|
||||
if (preference == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadUtils.postOnBackgroundThread(() -> {
|
||||
final NumberFormat percentageFormat = NumberFormat.getPercentInstance();
|
||||
final PrivateStorageInfo info = PrivateStorageInfo.getPrivateStorageInfo(
|
||||
mStorageManagerVolumeProvider);
|
||||
final double privateUsedBytes = info.totalBytes - info.freeBytes;
|
||||
|
||||
ThreadUtils.postOnMainThread(() -> {
|
||||
preference.setSummary(mContext.getString(R.string.storage_summary,
|
||||
percentageFormat.format(privateUsedBytes / info.totalBytes),
|
||||
Formatter.formatFileSize(mContext, info.freeBytes)));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -58,11 +58,13 @@ public class BiometricFragment extends InstrumentedFragment {
|
||||
private Bundle mBundle;
|
||||
private BiometricPrompt mBiometricPrompt;
|
||||
private CancellationSignal mCancellationSignal;
|
||||
private boolean mAuthenticating;
|
||||
|
||||
private AuthenticationCallback mAuthenticationCallback =
|
||||
new AuthenticationCallback() {
|
||||
@Override
|
||||
public void onAuthenticationError(int error, @NonNull CharSequence message) {
|
||||
mAuthenticating = false;
|
||||
mClientExecutor.execute(() -> {
|
||||
mClientCallback.onAuthenticationError(error, message);
|
||||
});
|
||||
@@ -71,6 +73,7 @@ public class BiometricFragment extends InstrumentedFragment {
|
||||
|
||||
@Override
|
||||
public void onAuthenticationSucceeded(AuthenticationResult result) {
|
||||
mAuthenticating = false;
|
||||
mClientExecutor.execute(() -> {
|
||||
mClientCallback.onAuthenticationSucceeded(result);
|
||||
});
|
||||
@@ -134,6 +137,10 @@ public class BiometricFragment extends InstrumentedFragment {
|
||||
}
|
||||
}
|
||||
|
||||
boolean isAuthenticating() {
|
||||
return mAuthenticating;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -180,6 +187,7 @@ public class BiometricFragment extends InstrumentedFragment {
|
||||
mCancellationSignal = new CancellationSignal();
|
||||
|
||||
// TODO: CC doesn't use crypto for now
|
||||
mAuthenticating = true;
|
||||
mBiometricPrompt.authenticateUser(mCancellationSignal, mClientExecutor,
|
||||
mAuthenticationCallback, mUserId, mCancelCallback);
|
||||
}
|
||||
|
@@ -251,7 +251,10 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
if (!isChangingConfigurations()) {
|
||||
mGoingToBackground = true;
|
||||
if (mBiometricFragment != null) {
|
||||
mBiometricFragment.cancel();
|
||||
Log.d(TAG, "Authenticating: " + mBiometricFragment.isAuthenticating());
|
||||
if (mBiometricFragment.isAuthenticating()) {
|
||||
mBiometricFragment.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
if (mIsFallback && !mCCLaunched) {
|
||||
|
Reference in New Issue
Block a user