Merge "Further fixes on VIMS.onPreCreatedUserConversion()" into tm-qpr-dev
This commit is contained in:
@@ -136,9 +136,6 @@ public class VoiceInteractionManagerService extends SystemService {
|
|||||||
private final RemoteCallbackList<IVoiceInteractionSessionListener>
|
private final RemoteCallbackList<IVoiceInteractionSessionListener>
|
||||||
mVoiceInteractionSessionListeners = new RemoteCallbackList<>();
|
mVoiceInteractionSessionListeners = new RemoteCallbackList<>();
|
||||||
|
|
||||||
// TODO(b/226201975): remove once RoleService supports pre-created users
|
|
||||||
private final ArrayList<UserHandle> mIgnoredPreCreatedUsers = new ArrayList<>();
|
|
||||||
|
|
||||||
public VoiceInteractionManagerService(Context context) {
|
public VoiceInteractionManagerService(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@@ -308,24 +305,14 @@ public class VoiceInteractionManagerService extends SystemService {
|
|||||||
return hotwordDetectionConnection.mIdentity;
|
return hotwordDetectionConnection.mIdentity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(b/226201975): remove this method once RoleService supports pre-created users
|
||||||
@Override
|
@Override
|
||||||
public void onPreCreatedUserConversion(int userId) {
|
public void onPreCreatedUserConversion(int userId) {
|
||||||
Slogf.d(TAG, "onPreCreatedUserConversion(%d)", userId);
|
Slogf.d(TAG, "onPreCreatedUserConversion(%d): calling onRoleHoldersChanged() again",
|
||||||
|
userId);
|
||||||
for (int i = 0; i < mIgnoredPreCreatedUsers.size(); i++) {
|
mServiceStub.mRoleObserver.onRoleHoldersChanged(RoleManager.ROLE_ASSISTANT,
|
||||||
UserHandle preCreatedUser = mIgnoredPreCreatedUsers.get(i);
|
UserHandle.of(userId));
|
||||||
if (preCreatedUser.getIdentifier() == userId) {
|
|
||||||
Slogf.d(TAG, "Updating role on pre-created user %d", userId);
|
|
||||||
mServiceStub.mRoleObserver.onRoleHoldersChanged(RoleManager.ROLE_ASSISTANT,
|
|
||||||
preCreatedUser);
|
|
||||||
mIgnoredPreCreatedUsers.remove(i);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Slogf.w(TAG, "onPreCreatedUserConversion(%d): not available on "
|
|
||||||
+ "mIgnoredPreCreatedUserIds (%s)", userId, mIgnoredPreCreatedUsers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// implementation entry point and binder service
|
// implementation entry point and binder service
|
||||||
@@ -807,8 +794,10 @@ public class VoiceInteractionManagerService extends SystemService {
|
|||||||
if (TextUtils.isEmpty(curInteractor)) {
|
if (TextUtils.isEmpty(curInteractor)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (DEBUG) Slog.d(TAG, "getCurInteractor curInteractor=" + curInteractor
|
if (DEBUG) {
|
||||||
|
Slog.d(TAG, "getCurInteractor curInteractor=" + curInteractor
|
||||||
+ " user=" + userHandle);
|
+ " user=" + userHandle);
|
||||||
|
}
|
||||||
return ComponentName.unflattenFromString(curInteractor);
|
return ComponentName.unflattenFromString(curInteractor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -816,8 +805,9 @@ public class VoiceInteractionManagerService extends SystemService {
|
|||||||
Settings.Secure.putStringForUser(mContext.getContentResolver(),
|
Settings.Secure.putStringForUser(mContext.getContentResolver(),
|
||||||
Settings.Secure.VOICE_INTERACTION_SERVICE,
|
Settings.Secure.VOICE_INTERACTION_SERVICE,
|
||||||
comp != null ? comp.flattenToShortString() : "", userHandle);
|
comp != null ? comp.flattenToShortString() : "", userHandle);
|
||||||
if (DEBUG) Slog.d(TAG, "setCurInteractor comp=" + comp
|
if (DEBUG) {
|
||||||
+ " user=" + userHandle);
|
Slog.d(TAG, "setCurInteractor comp=" + comp + " user=" + userHandle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ComponentName findAvailRecognizer(String prefPackage, int userHandle) {
|
ComponentName findAvailRecognizer(String prefPackage, int userHandle) {
|
||||||
@@ -1912,7 +1902,6 @@ public class VoiceInteractionManagerService extends SystemService {
|
|||||||
pw.println(" mTemporarilyDisabled: " + mTemporarilyDisabled);
|
pw.println(" mTemporarilyDisabled: " + mTemporarilyDisabled);
|
||||||
pw.println(" mCurUser: " + mCurUser);
|
pw.println(" mCurUser: " + mCurUser);
|
||||||
pw.println(" mCurUserSupported: " + mCurUserSupported);
|
pw.println(" mCurUserSupported: " + mCurUserSupported);
|
||||||
pw.println(" mIgnoredPreCreatedUsers: " + mIgnoredPreCreatedUsers);
|
|
||||||
dumpSupportedUsers(pw, " ");
|
dumpSupportedUsers(pw, " ");
|
||||||
mDbHelper.dump(pw);
|
mDbHelper.dump(pw);
|
||||||
if (mImpl == null) {
|
if (mImpl == null) {
|
||||||
@@ -2026,6 +2015,11 @@ public class VoiceInteractionManagerService extends SystemService {
|
|||||||
|
|
||||||
List<String> roleHolders = mRm.getRoleHoldersAsUser(roleName, user);
|
List<String> roleHolders = mRm.getRoleHoldersAsUser(roleName, user);
|
||||||
|
|
||||||
|
if (DEBUG) {
|
||||||
|
Slogf.d(TAG, "onRoleHoldersChanged(%s, %s): roleHolders=%s", roleName, user,
|
||||||
|
roleHolders);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(b/226201975): this method is beling called when a pre-created user is added,
|
// TODO(b/226201975): this method is beling called when a pre-created user is added,
|
||||||
// at which point it doesn't have any role holders. But it's not called again when
|
// at which point it doesn't have any role holders. But it's not called again when
|
||||||
// the actual user is added (i.e., when the pre-created user is converted), so we
|
// the actual user is added (i.e., when the pre-created user is converted), so we
|
||||||
@@ -2036,9 +2030,9 @@ public class VoiceInteractionManagerService extends SystemService {
|
|||||||
if (roleHolders.isEmpty()) {
|
if (roleHolders.isEmpty()) {
|
||||||
UserInfo userInfo = mUserManagerInternal.getUserInfo(user.getIdentifier());
|
UserInfo userInfo = mUserManagerInternal.getUserInfo(user.getIdentifier());
|
||||||
if (userInfo != null && userInfo.preCreated) {
|
if (userInfo != null && userInfo.preCreated) {
|
||||||
Slogf.d(TAG, "onRoleHoldersChanged(): ignoring pre-created user %s for now",
|
Slogf.d(TAG, "onRoleHoldersChanged(): ignoring pre-created user %s for now,"
|
||||||
userInfo.toFullString());
|
+ " this method will be called again when it's converted to a real"
|
||||||
mIgnoredPreCreatedUsers.add(user);
|
+ " user", userInfo.toFullString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user