Stop trying to get/set fields in FDE footer am: 77d147be49

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2016257

Change-Id: I47b2b768f174ca7907509f34db815f53fd67e947
This commit is contained in:
Eric Biggers
2022-03-10 00:55:39 +00:00
committed by Automerger Merge Worker
3 changed files with 1 additions and 112 deletions

View File

@@ -701,38 +701,14 @@ public class LockPatternUtils {
return true; return true;
} }
private void updateCryptoUserInfo(int userId) {
if (userId != UserHandle.USER_SYSTEM) {
return;
}
final String ownerInfo = isOwnerInfoEnabled(userId) ? getOwnerInfo(userId) : "";
IBinder service = ServiceManager.getService("mount");
if (service == null) {
Log.e(TAG, "Could not find the mount service to update the user info");
return;
}
IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
try {
Log.d(TAG, "Setting owner info");
storageManager.setField(StorageManager.OWNER_INFO_KEY, ownerInfo);
} catch (RemoteException e) {
Log.e(TAG, "Error changing user info", e);
}
}
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public void setOwnerInfo(String info, int userId) { public void setOwnerInfo(String info, int userId) {
setString(LOCK_SCREEN_OWNER_INFO, info, userId); setString(LOCK_SCREEN_OWNER_INFO, info, userId);
updateCryptoUserInfo(userId);
} }
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public void setOwnerInfoEnabled(boolean enabled, int userId) { public void setOwnerInfoEnabled(boolean enabled, int userId) {
setBoolean(LOCK_SCREEN_OWNER_INFO_ENABLED, enabled, userId); setBoolean(LOCK_SCREEN_OWNER_INFO_ENABLED, enabled, userId);
updateCryptoUserInfo(userId);
} }
@UnsupportedAppUsage @UnsupportedAppUsage
@@ -988,24 +964,6 @@ public class LockPatternUtils {
*/ */
public void setVisiblePatternEnabled(boolean enabled, int userId) { public void setVisiblePatternEnabled(boolean enabled, int userId) {
setBoolean(Settings.Secure.LOCK_PATTERN_VISIBLE, enabled, userId); setBoolean(Settings.Secure.LOCK_PATTERN_VISIBLE, enabled, userId);
// Update for crypto if owner
if (userId != UserHandle.USER_SYSTEM) {
return;
}
IBinder service = ServiceManager.getService("mount");
if (service == null) {
Log.e(TAG, "Could not find the mount service to update the user info");
return;
}
IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
try {
storageManager.setField(StorageManager.PATTERN_VISIBLE_KEY, enabled ? "1" : "0");
} catch (RemoteException e) {
Log.e(TAG, "Error changing pattern visible state", e);
}
} }
public boolean isVisiblePatternEverChosen(int userId) { public boolean isVisiblePatternEverChosen(int userId) {
@@ -1016,23 +974,7 @@ public class LockPatternUtils {
* Set whether the visible password is enabled for cryptkeeper screen. * Set whether the visible password is enabled for cryptkeeper screen.
*/ */
public void setVisiblePasswordEnabled(boolean enabled, int userId) { public void setVisiblePasswordEnabled(boolean enabled, int userId) {
// Update for crypto if owner // No longer does anything.
if (userId != UserHandle.USER_SYSTEM) {
return;
}
IBinder service = ServiceManager.getService("mount");
if (service == null) {
Log.e(TAG, "Could not find the mount service to update the user info");
return;
}
IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
try {
storageManager.setField(StorageManager.PASSWORD_VISIBLE_KEY, enabled ? "1" : "0");
} catch (RemoteException e) {
Log.e(TAG, "Error changing password visible state", e);
}
} }
/** /**

View File

@@ -75,7 +75,6 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManagerInternal; import android.content.pm.PackageManagerInternal;
import android.content.pm.ProviderInfo; import android.content.pm.ProviderInfo;
import android.content.pm.UserInfo; import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.content.res.ObbInfo; import android.content.res.ObbInfo;
import android.database.ContentObserver; import android.database.ContentObserver;
import android.net.Uri; import android.net.Uri;
@@ -122,7 +121,6 @@ import android.provider.DocumentsContract;
import android.provider.Downloads; import android.provider.Downloads;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.provider.Settings; import android.provider.Settings;
import android.sysprop.VoldProperties;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.util.ArrayMap; import android.util.ArrayMap;
@@ -1380,39 +1378,6 @@ class StorageManagerService extends IStorageManager.Stub
private void handleDaemonConnected() { private void handleDaemonConnected() {
initIfBootedAndConnected(); initIfBootedAndConnected();
resetIfBootedAndConnected(); resetIfBootedAndConnected();
// On an encrypted device we can't see system properties yet, so pull
// the system locale out of the mount service.
if ("".equals(VoldProperties.encrypt_progress().orElse(""))) {
copyLocaleFromMountService();
}
}
private void copyLocaleFromMountService() {
String systemLocale;
try {
systemLocale = getField(StorageManager.SYSTEM_LOCALE_KEY);
} catch (RemoteException e) {
return;
}
if (TextUtils.isEmpty(systemLocale)) {
return;
}
Slog.d(TAG, "Got locale " + systemLocale + " from mount service");
Locale locale = Locale.forLanguageTag(systemLocale);
Configuration config = new Configuration();
config.setLocale(locale);
try {
ActivityManager.getService().updatePersistentConfigurationWithAttribution(config,
mContext.getOpPackageName(), mContext.getAttributionTag());
} catch (RemoteException e) {
Slog.e(TAG, "Error setting system locale from mount service", e);
}
// Temporary workaround for http://b/17945169.
Slog.d(TAG, "Setting system properties to " + systemLocale + " from mount service");
SystemProperties.set("persist.sys.locale", locale.toLanguageTag());
} }
private final IVoldListener mListener = new IVoldListener.Stub() { private final IVoldListener mListener = new IVoldListener.Stub() {

View File

@@ -203,8 +203,6 @@ import android.os.UpdateLock;
import android.os.UserHandle; import android.os.UserHandle;
import android.os.UserManager; import android.os.UserManager;
import android.os.WorkSource; import android.os.WorkSource;
import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.provider.Settings; import android.provider.Settings;
import android.service.dreams.DreamActivity; import android.service.dreams.DreamActivity;
import android.service.voice.IVoiceInteractionSession; import android.service.voice.IVoiceInteractionSession;
@@ -4209,11 +4207,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
SystemProperties.set("persist.sys.locale", SystemProperties.set("persist.sys.locale",
locales.get(bestLocaleIndex).toLanguageTag()); locales.get(bestLocaleIndex).toLanguageTag());
LocaleList.setDefault(locales, bestLocaleIndex); LocaleList.setDefault(locales, bestLocaleIndex);
final Message m = PooledLambda.obtainMessage(
ActivityTaskManagerService::sendLocaleToMountDaemonMsg, this,
locales.get(bestLocaleIndex));
mH.sendMessage(m);
} }
mTempConfig.seq = increaseConfigurationSeqLocked(); mTempConfig.seq = increaseConfigurationSeqLocked();
@@ -4367,17 +4360,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
Settings.System.putConfigurationForUser(resolver, config, userId); Settings.System.putConfigurationForUser(resolver, config, userId);
} }
private void sendLocaleToMountDaemonMsg(Locale l) {
try {
IBinder service = ServiceManager.getService("mount");
IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
Log.d(TAG, "Storing locale " + l.toLanguageTag() + " for decryption UI");
storageManager.setField(StorageManager.SYSTEM_LOCALE_KEY, l.toLanguageTag());
} catch (RemoteException e) {
Log.e(TAG, "Error storing locale for decryption UI", e);
}
}
private void expireStartAsCallerTokenMsg(IBinder permissionToken) { private void expireStartAsCallerTokenMsg(IBinder permissionToken) {
mStartActivitySources.remove(permissionToken); mStartActivitySources.remove(permissionToken);
mExpiredStartAsCallerTokens.add(permissionToken); mExpiredStartAsCallerTokens.add(permissionToken);