Merge changes I7cc11e08,Ia2afd2e4 into udc-dev
* changes: Fix SecurityException in Autofill Catch all exceptions in AutofillManagerService methods.
This commit is contained in:
@@ -2065,7 +2065,7 @@ public final class AutofillManager {
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
} catch (SyncResultReceiver.TimeoutException e) {
|
} catch (SyncResultReceiver.TimeoutException e) {
|
||||||
throw new RuntimeException("Fail to get enabled autofill services status.");
|
throw new RuntimeException("Fail to get enabled autofill services status. " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2084,7 +2084,7 @@ public final class AutofillManager {
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
} catch (SyncResultReceiver.TimeoutException e) {
|
} catch (SyncResultReceiver.TimeoutException e) {
|
||||||
throw new RuntimeException("Fail to get autofill services component name.");
|
throw new RuntimeException("Fail to get autofill services component name. " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2111,7 +2111,7 @@ public final class AutofillManager {
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
} catch (SyncResultReceiver.TimeoutException e) {
|
} catch (SyncResultReceiver.TimeoutException e) {
|
||||||
throw new RuntimeException("Fail to get user data id for field classification.");
|
throw new RuntimeException("Fail to get user data id for field classification. " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2134,7 +2134,7 @@ public final class AutofillManager {
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
} catch (SyncResultReceiver.TimeoutException e) {
|
} catch (SyncResultReceiver.TimeoutException e) {
|
||||||
throw new RuntimeException("Fail to get user data for field classification.");
|
throw new RuntimeException("Fail to get user data for field classification. " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2174,7 +2174,7 @@ public final class AutofillManager {
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
} catch (SyncResultReceiver.TimeoutException e) {
|
} catch (SyncResultReceiver.TimeoutException e) {
|
||||||
throw new RuntimeException("Fail to get field classification enabled status.");
|
throw new RuntimeException("Fail to get field classification enabled status. " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2198,7 +2198,7 @@ public final class AutofillManager {
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
} catch (SyncResultReceiver.TimeoutException e) {
|
} catch (SyncResultReceiver.TimeoutException e) {
|
||||||
throw new RuntimeException("Fail to get default field classification algorithm.");
|
throw new RuntimeException("Fail to get default field classification algorithm. " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2220,7 +2220,8 @@ public final class AutofillManager {
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
} catch (SyncResultReceiver.TimeoutException e) {
|
} catch (SyncResultReceiver.TimeoutException e) {
|
||||||
throw new RuntimeException("Fail to get available field classification algorithms.");
|
throw new
|
||||||
|
RuntimeException("Fail to get available field classification algorithms. " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2244,7 +2245,7 @@ public final class AutofillManager {
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
} catch (SyncResultReceiver.TimeoutException e) {
|
} catch (SyncResultReceiver.TimeoutException e) {
|
||||||
throw new RuntimeException("Fail to get autofill supported status.");
|
throw new RuntimeException("Fail to get autofill supported status. " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ import android.text.TextUtils;
|
|||||||
import android.text.TextUtils.SimpleStringSplitter;
|
import android.text.TextUtils.SimpleStringSplitter;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
import android.util.LocalLog;
|
import android.util.LocalLog;
|
||||||
|
import android.util.Log;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.util.SparseBooleanArray;
|
import android.util.SparseBooleanArray;
|
||||||
@@ -334,7 +335,8 @@ public final class AutofillManagerService
|
|||||||
// of time.
|
// of time.
|
||||||
|
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
final AutofillManagerServiceImpl service =
|
||||||
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
service.onSwitchInputMethod();
|
service.onSwitchInputMethod();
|
||||||
}
|
}
|
||||||
@@ -366,11 +368,12 @@ public final class AutofillManagerService
|
|||||||
boolean isTemporary) {
|
boolean isTemporary) {
|
||||||
mAugmentedAutofillState.setServiceInfo(userId, serviceName, isTemporary);
|
mAugmentedAutofillState.setServiceInfo(userId, serviceName, isTemporary);
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
final AutofillManagerServiceImpl service =
|
||||||
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
if (service == null) {
|
if (service == null) {
|
||||||
// If we cannot get the service from the services cache, it will call
|
// If we cannot get the service from the services cache, it will call
|
||||||
// updateRemoteAugmentedAutofillService() finally. Skip call this update again.
|
// updateRemoteAugmentedAutofillService() finally. Skip call this update again.
|
||||||
getServiceForUserLocked(userId);
|
getServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
} else {
|
} else {
|
||||||
service.updateRemoteAugmentedAutofillService();
|
service.updateRemoteAugmentedAutofillService();
|
||||||
}
|
}
|
||||||
@@ -380,17 +383,46 @@ public final class AutofillManagerService
|
|||||||
private void onFieldClassificationServiceNameChanged(
|
private void onFieldClassificationServiceNameChanged(
|
||||||
@UserIdInt int userId, @Nullable String serviceName, boolean isTemporary) {
|
@UserIdInt int userId, @Nullable String serviceName, boolean isTemporary) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
final AutofillManagerServiceImpl service =
|
||||||
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
if (service == null) {
|
if (service == null) {
|
||||||
// If we cannot get the service from the services cache, it will call
|
// If we cannot get the service from the services cache, it will call
|
||||||
// updateRemoteFieldClassificationService() finally. Skip call this update again.
|
// updateRemoteFieldClassificationService() finally. Skip call this update again.
|
||||||
getServiceForUserLocked(userId);
|
getServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
} else {
|
} else {
|
||||||
service.updateRemoteFieldClassificationService();
|
service.updateRemoteFieldClassificationService();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GuardedBy("mLock")
|
||||||
|
@Nullable
|
||||||
|
private AutofillManagerServiceImpl getServiceForUserWithLocalBinderIdentityLocked(int userId) {
|
||||||
|
final long token = Binder.clearCallingIdentity();
|
||||||
|
AutofillManagerServiceImpl managerService = null;
|
||||||
|
try {
|
||||||
|
managerService = getServiceForUserLocked(userId);
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
return managerService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GuardedBy("mLock")
|
||||||
|
@Nullable
|
||||||
|
private AutofillManagerServiceImpl peekServiceForUserWithLocalBinderIdentityLocked(int userId) {
|
||||||
|
final long token = Binder.clearCallingIdentity();
|
||||||
|
AutofillManagerServiceImpl managerService = null;
|
||||||
|
try {
|
||||||
|
managerService = peekServiceForUserLocked(userId);
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
return managerService;
|
||||||
|
}
|
||||||
|
|
||||||
@Override // from AbstractMasterSystemService
|
@Override // from AbstractMasterSystemService
|
||||||
protected AutofillManagerServiceImpl newServiceLocked(@UserIdInt int resolvedUserId,
|
protected AutofillManagerServiceImpl newServiceLocked(@UserIdInt int resolvedUserId,
|
||||||
boolean disabled) {
|
boolean disabled) {
|
||||||
@@ -1038,7 +1070,8 @@ public final class AutofillManagerService
|
|||||||
mUi.hideAll(null);
|
mUi.hideAll(null);
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service =
|
final AutofillManagerServiceImpl service =
|
||||||
getServiceForUserLocked(UserHandle.getCallingUserId());
|
getServiceForUserWithLocalBinderIdentityLocked(
|
||||||
|
UserHandle.getCallingUserId());
|
||||||
service.onBackKeyPressed();
|
service.onBackKeyPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1537,20 +1570,27 @@ public final class AutofillManagerService
|
|||||||
public void addClient(IAutoFillManagerClient client, ComponentName componentName,
|
public void addClient(IAutoFillManagerClient client, ComponentName componentName,
|
||||||
int userId, IResultReceiver receiver) {
|
int userId, IResultReceiver receiver) {
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
synchronized (mLock) {
|
try {
|
||||||
final int enabledFlags = getServiceForUserLocked(userId).addClientLocked(client,
|
synchronized (mLock) {
|
||||||
componentName);
|
final int enabledFlags =
|
||||||
if (enabledFlags != 0) {
|
getServiceForUserWithLocalBinderIdentityLocked(userId)
|
||||||
flags |= enabledFlags;
|
.addClientLocked(client, componentName);
|
||||||
}
|
if (enabledFlags != 0) {
|
||||||
if (sDebug) {
|
flags |= enabledFlags;
|
||||||
flags |= AutofillManager.FLAG_ADD_CLIENT_DEBUG;
|
}
|
||||||
}
|
if (sDebug) {
|
||||||
if (sVerbose) {
|
flags |= AutofillManager.FLAG_ADD_CLIENT_DEBUG;
|
||||||
flags |= AutofillManager.FLAG_ADD_CLIENT_VERBOSE;
|
}
|
||||||
|
if (sVerbose) {
|
||||||
|
flags |= AutofillManager.FLAG_ADD_CLIENT_VERBOSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// Don't do anything, send back default flags
|
||||||
|
Log.wtf(TAG, "addClient(): failed " + ex.toString());
|
||||||
|
} finally {
|
||||||
|
send(receiver, flags);
|
||||||
}
|
}
|
||||||
send(receiver, flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1569,7 +1609,8 @@ public final class AutofillManagerService
|
|||||||
public void setAuthenticationResult(Bundle data, int sessionId, int authenticationId,
|
public void setAuthenticationResult(Bundle data, int sessionId, int authenticationId,
|
||||||
int userId) {
|
int userId) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = getServiceForUserLocked(userId);
|
final AutofillManagerServiceImpl service =
|
||||||
|
getServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
service.setAuthenticationResultLocked(data, sessionId, authenticationId,
|
service.setAuthenticationResultLocked(data, sessionId, authenticationId,
|
||||||
getCallingUid());
|
getCallingUid());
|
||||||
}
|
}
|
||||||
@@ -1578,7 +1619,8 @@ public final class AutofillManagerService
|
|||||||
@Override
|
@Override
|
||||||
public void setHasCallback(int sessionId, int userId, boolean hasIt) {
|
public void setHasCallback(int sessionId, int userId, boolean hasIt) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = getServiceForUserLocked(userId);
|
final AutofillManagerServiceImpl service =
|
||||||
|
getServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
service.setHasCallback(sessionId, getCallingUid(), hasIt);
|
service.setHasCallback(sessionId, getCallingUid(), hasIt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1608,7 +1650,8 @@ public final class AutofillManagerService
|
|||||||
final int taskId = mAm.getTaskIdForActivity(activityToken, false);
|
final int taskId = mAm.getTaskIdForActivity(activityToken, false);
|
||||||
final long result;
|
final long result;
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = getServiceForUserLocked(userId);
|
final AutofillManagerServiceImpl service =
|
||||||
|
getServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
result = service.startSessionLocked(activityToken, taskId, getCallingUid(),
|
result = service.startSessionLocked(activityToken, taskId, getCallingUid(),
|
||||||
clientCallback, autofillId, bounds, value, hasCallback, clientActivity,
|
clientCallback, autofillId, bounds, value, hasCallback, clientActivity,
|
||||||
compatMode, mAllowInstantService, flags);
|
compatMode, mAllowInstantService, flags);
|
||||||
@@ -1624,51 +1667,72 @@ public final class AutofillManagerService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getFillEventHistory(@NonNull IResultReceiver receiver) throws RemoteException {
|
public void getFillEventHistory(@NonNull IResultReceiver receiver) throws RemoteException {
|
||||||
|
FillEventHistory fillEventHistory = null;
|
||||||
final int userId = UserHandle.getCallingUserId();
|
final int userId = UserHandle.getCallingUserId();
|
||||||
|
|
||||||
FillEventHistory fillEventHistory = null;
|
try {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
final AutofillManagerServiceImpl service =
|
||||||
if (service != null) {
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
fillEventHistory = service.getFillEventHistory(getCallingUid());
|
if (service != null) {
|
||||||
} else if (sVerbose) {
|
fillEventHistory = service.getFillEventHistory(getCallingUid());
|
||||||
Slog.v(TAG, "getFillEventHistory(): no service for " + userId);
|
} else if (sVerbose) {
|
||||||
|
Slog.v(TAG, "getFillEventHistory(): no service for " + userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// Do not raise the exception, just send back the null response
|
||||||
|
Log.wtf(TAG, "getFillEventHistory(): failed " + ex.toString());
|
||||||
|
} finally {
|
||||||
|
send(receiver, fillEventHistory);
|
||||||
}
|
}
|
||||||
send(receiver, fillEventHistory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getUserData(@NonNull IResultReceiver receiver) throws RemoteException {
|
public void getUserData(@NonNull IResultReceiver receiver) throws RemoteException {
|
||||||
|
UserData userData = null;
|
||||||
final int userId = UserHandle.getCallingUserId();
|
final int userId = UserHandle.getCallingUserId();
|
||||||
|
|
||||||
UserData userData = null;
|
try {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
final AutofillManagerServiceImpl service =
|
||||||
if (service != null) {
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
userData = service.getUserData(getCallingUid());
|
if (service != null) {
|
||||||
} else if (sVerbose) {
|
userData = service.getUserData(getCallingUid());
|
||||||
Slog.v(TAG, "getUserData(): no service for " + userId);
|
} else if (sVerbose) {
|
||||||
|
Slog.v(TAG, "getUserData(): no service for " + userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// Do not raise the exception, just send back the null response
|
||||||
|
Log.wtf(TAG, "getUserData(): failed " + ex.toString());
|
||||||
|
} finally {
|
||||||
|
send(receiver, userData);
|
||||||
}
|
}
|
||||||
send(receiver, userData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getUserDataId(@NonNull IResultReceiver receiver) throws RemoteException {
|
public void getUserDataId(@NonNull IResultReceiver receiver) throws RemoteException {
|
||||||
final int userId = UserHandle.getCallingUserId();
|
|
||||||
UserData userData = null;
|
UserData userData = null;
|
||||||
|
final int userId = UserHandle.getCallingUserId();
|
||||||
|
|
||||||
synchronized (mLock) {
|
try {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
synchronized (mLock) {
|
||||||
if (service != null) {
|
final AutofillManagerServiceImpl service =
|
||||||
userData = service.getUserData(getCallingUid());
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
} else if (sVerbose) {
|
if (service != null) {
|
||||||
Slog.v(TAG, "getUserDataId(): no service for " + userId);
|
userData = service.getUserData(getCallingUid());
|
||||||
|
} else if (sVerbose) {
|
||||||
|
Slog.v(TAG, "getUserDataId(): no service for " + userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// Do not raise the exception, just send back the null response
|
||||||
|
Log.wtf(TAG, "getUserDataId(): failed " + ex.toString());
|
||||||
|
} finally {
|
||||||
|
final String userDataId = userData == null ? null : userData.getId();
|
||||||
|
send(receiver, userDataId);
|
||||||
}
|
}
|
||||||
final String userDataId = userData == null ? null : userData.getId();
|
|
||||||
send(receiver, userDataId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1676,7 +1740,8 @@ public final class AutofillManagerService
|
|||||||
final int userId = UserHandle.getCallingUserId();
|
final int userId = UserHandle.getCallingUserId();
|
||||||
|
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
final AutofillManagerServiceImpl service =
|
||||||
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
service.setUserData(getCallingUid(), userData);
|
service.setUserData(getCallingUid(), userData);
|
||||||
} else if (sVerbose) {
|
} else if (sVerbose) {
|
||||||
@@ -1688,124 +1753,171 @@ public final class AutofillManagerService
|
|||||||
@Override
|
@Override
|
||||||
public void isFieldClassificationEnabled(@NonNull IResultReceiver receiver)
|
public void isFieldClassificationEnabled(@NonNull IResultReceiver receiver)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
final int userId = UserHandle.getCallingUserId();
|
|
||||||
boolean enabled = false;
|
boolean enabled = false;
|
||||||
|
final int userId = UserHandle.getCallingUserId();
|
||||||
|
|
||||||
synchronized (mLock) {
|
try {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
synchronized (mLock) {
|
||||||
if (service != null) {
|
final AutofillManagerServiceImpl service =
|
||||||
enabled = service.isFieldClassificationEnabled(getCallingUid());
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
} else if (sVerbose) {
|
if (service != null) {
|
||||||
Slog.v(TAG, "isFieldClassificationEnabled(): no service for " + userId);
|
enabled = service.isFieldClassificationEnabled(getCallingUid());
|
||||||
|
} else if (sVerbose) {
|
||||||
|
Slog.v(TAG, "isFieldClassificationEnabled(): no service for " + userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// Do not raise the exception, just send back false
|
||||||
|
Log.wtf(TAG, "isFieldClassificationEnabled(): failed " + ex.toString());
|
||||||
|
} finally {
|
||||||
|
send(receiver, enabled);
|
||||||
}
|
}
|
||||||
send(receiver, enabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getDefaultFieldClassificationAlgorithm(@NonNull IResultReceiver receiver)
|
public void getDefaultFieldClassificationAlgorithm(@NonNull IResultReceiver receiver)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
final int userId = UserHandle.getCallingUserId();
|
|
||||||
String algorithm = null;
|
String algorithm = null;
|
||||||
|
final int userId = UserHandle.getCallingUserId();
|
||||||
|
|
||||||
synchronized (mLock) {
|
try {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
synchronized (mLock) {
|
||||||
if (service != null) {
|
final AutofillManagerServiceImpl service =
|
||||||
algorithm = service.getDefaultFieldClassificationAlgorithm(getCallingUid());
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
} else {
|
if (service != null) {
|
||||||
if (sVerbose) {
|
algorithm = service.getDefaultFieldClassificationAlgorithm(getCallingUid());
|
||||||
Slog.v(TAG, "getDefaultFcAlgorithm(): no service for " + userId);
|
} else {
|
||||||
|
if (sVerbose) {
|
||||||
|
Slog.v(TAG, "getDefaultFcAlgorithm(): no service for " + userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// Do not raise the exception, just send back null
|
||||||
|
Log.wtf(TAG, "getDefaultFieldClassificationAlgorithm(): failed " + ex.toString());
|
||||||
|
} finally {
|
||||||
|
send(receiver, algorithm);
|
||||||
}
|
}
|
||||||
send(receiver, algorithm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAugmentedAutofillWhitelist(@Nullable List<String> packages,
|
public void setAugmentedAutofillWhitelist(@Nullable List<String> packages,
|
||||||
@Nullable List<ComponentName> activities, @NonNull IResultReceiver receiver)
|
@Nullable List<ComponentName> activities, @NonNull IResultReceiver receiver)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
|
boolean ok = false;
|
||||||
final int userId = UserHandle.getCallingUserId();
|
final int userId = UserHandle.getCallingUserId();
|
||||||
|
|
||||||
boolean ok;
|
try {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
final AutofillManagerServiceImpl service =
|
||||||
if (service != null) {
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
ok = service.setAugmentedAutofillWhitelistLocked(packages, activities,
|
if (service != null) {
|
||||||
getCallingUid());
|
ok = service.setAugmentedAutofillWhitelistLocked(packages, activities,
|
||||||
} else {
|
getCallingUid());
|
||||||
if (sVerbose) {
|
} else {
|
||||||
Slog.v(TAG, "setAugmentedAutofillWhitelist(): no service for " + userId);
|
if (sVerbose) {
|
||||||
|
Slog.v(TAG, "setAugmentedAutofillWhitelist(): no service for "
|
||||||
|
+ userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ok = false;
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// Do not raise the exception, return the default value
|
||||||
|
Log.wtf(TAG, "setAugmentedAutofillWhitelist(): failed " + ex.toString());
|
||||||
|
} finally {
|
||||||
|
send(receiver,
|
||||||
|
ok ? AutofillManager.RESULT_OK
|
||||||
|
: AutofillManager.RESULT_CODE_NOT_SERVICE);
|
||||||
}
|
}
|
||||||
send(receiver,
|
|
||||||
ok ? AutofillManager.RESULT_OK : AutofillManager.RESULT_CODE_NOT_SERVICE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getAvailableFieldClassificationAlgorithms(@NonNull IResultReceiver receiver)
|
public void getAvailableFieldClassificationAlgorithms(@NonNull IResultReceiver receiver)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
final int userId = UserHandle.getCallingUserId();
|
|
||||||
String[] algorithms = null;
|
String[] algorithms = null;
|
||||||
|
final int userId = UserHandle.getCallingUserId();
|
||||||
|
|
||||||
synchronized (mLock) {
|
try {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
synchronized (mLock) {
|
||||||
if (service != null) {
|
final AutofillManagerServiceImpl service =
|
||||||
algorithms = service.getAvailableFieldClassificationAlgorithms(getCallingUid());
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
} else {
|
if (service != null) {
|
||||||
if (sVerbose) {
|
algorithms = service
|
||||||
Slog.v(TAG, "getAvailableFcAlgorithms(): no service for " + userId);
|
.getAvailableFieldClassificationAlgorithms(getCallingUid());
|
||||||
|
} else {
|
||||||
|
if (sVerbose) {
|
||||||
|
Slog.v(TAG, "getAvailableFcAlgorithms(): no service for " + userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// Do not raise the exception, return null
|
||||||
|
Log.wtf(TAG, "getAvailableFieldClassificationAlgorithms(): failed "
|
||||||
|
+ ex.toString());
|
||||||
|
} finally {
|
||||||
|
send(receiver, algorithms);
|
||||||
}
|
}
|
||||||
send(receiver, algorithms);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getAutofillServiceComponentName(@NonNull IResultReceiver receiver)
|
public void getAutofillServiceComponentName(@NonNull IResultReceiver receiver)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
|
ComponentName componentName = null;
|
||||||
final int userId = UserHandle.getCallingUserId();
|
final int userId = UserHandle.getCallingUserId();
|
||||||
|
|
||||||
ComponentName componentName = null;
|
try {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
final AutofillManagerServiceImpl service =
|
||||||
if (service != null) {
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
componentName = service.getServiceComponentName();
|
if (service != null) {
|
||||||
} else if (sVerbose) {
|
componentName = service.getServiceComponentName();
|
||||||
Slog.v(TAG, "getAutofillServiceComponentName(): no service for " + userId);
|
} else if (sVerbose) {
|
||||||
|
Slog.v(TAG, "getAutofillServiceComponentName(): no service for " + userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Log.wtf(TAG, "getAutofillServiceComponentName(): failed " + ex.toString());
|
||||||
|
} finally {
|
||||||
|
send(receiver, componentName);
|
||||||
}
|
}
|
||||||
send(receiver, componentName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void restoreSession(int sessionId, @NonNull IBinder activityToken,
|
public void restoreSession(int sessionId, @NonNull IBinder activityToken,
|
||||||
@NonNull IBinder appCallback, @NonNull IResultReceiver receiver)
|
@NonNull IBinder appCallback, @NonNull IResultReceiver receiver)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
final int userId = UserHandle.getCallingUserId();
|
|
||||||
Objects.requireNonNull(activityToken, "activityToken");
|
|
||||||
Objects.requireNonNull(appCallback, "appCallback");
|
|
||||||
|
|
||||||
boolean restored = false;
|
boolean restored = false;
|
||||||
synchronized (mLock) {
|
final int userId = UserHandle.getCallingUserId();
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
|
||||||
if (service != null) {
|
try {
|
||||||
restored = service.restoreSession(sessionId, getCallingUid(), activityToken,
|
Objects.requireNonNull(activityToken, "activityToken");
|
||||||
appCallback);
|
Objects.requireNonNull(appCallback, "appCallback");
|
||||||
} else if (sVerbose) {
|
|
||||||
Slog.v(TAG, "restoreSession(): no service for " + userId);
|
synchronized (mLock) {
|
||||||
|
final AutofillManagerServiceImpl service =
|
||||||
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
|
if (service != null) {
|
||||||
|
restored = service.restoreSession(sessionId, getCallingUid(), activityToken,
|
||||||
|
appCallback);
|
||||||
|
} else if (sVerbose) {
|
||||||
|
Slog.v(TAG, "restoreSession(): no service for " + userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// Do not propagate exception, send back status
|
||||||
|
Log.wtf(TAG, "restoreSession(): failed " + ex.toString());
|
||||||
|
} finally {
|
||||||
|
send(receiver, restored);
|
||||||
}
|
}
|
||||||
send(receiver, restored);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSession(int sessionId, AutofillId autoFillId, Rect bounds,
|
public void updateSession(int sessionId, AutofillId autoFillId, Rect bounds,
|
||||||
AutofillValue value, int action, int flags, int userId) {
|
AutofillValue value, int action, int flags, int userId) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
final AutofillManagerServiceImpl service =
|
||||||
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
service.updateSessionLocked(sessionId, getCallingUid(), autoFillId, bounds,
|
service.updateSessionLocked(sessionId, getCallingUid(), autoFillId, bounds,
|
||||||
value, action, flags);
|
value, action, flags);
|
||||||
@@ -1818,7 +1930,8 @@ public final class AutofillManagerService
|
|||||||
@Override
|
@Override
|
||||||
public void setAutofillFailure(int sessionId, @NonNull List<AutofillId> ids, int userId) {
|
public void setAutofillFailure(int sessionId, @NonNull List<AutofillId> ids, int userId) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
final AutofillManagerServiceImpl service =
|
||||||
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
service.setAutofillFailureLocked(sessionId, getCallingUid(), ids);
|
service.setAutofillFailureLocked(sessionId, getCallingUid(), ids);
|
||||||
} else if (sVerbose) {
|
} else if (sVerbose) {
|
||||||
@@ -1831,7 +1944,8 @@ public final class AutofillManagerService
|
|||||||
public void finishSession(int sessionId, int userId,
|
public void finishSession(int sessionId, int userId,
|
||||||
@AutofillCommitReason int commitReason) {
|
@AutofillCommitReason int commitReason) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
final AutofillManagerServiceImpl service =
|
||||||
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
service.finishSessionLocked(sessionId, getCallingUid(), commitReason);
|
service.finishSessionLocked(sessionId, getCallingUid(), commitReason);
|
||||||
} else if (sVerbose) {
|
} else if (sVerbose) {
|
||||||
@@ -1843,19 +1957,22 @@ public final class AutofillManagerService
|
|||||||
@Override
|
@Override
|
||||||
public void cancelSession(int sessionId, int userId) {
|
public void cancelSession(int sessionId, int userId) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
final AutofillManagerServiceImpl service =
|
||||||
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
service.cancelSessionLocked(sessionId, getCallingUid());
|
service.cancelSessionLocked(sessionId, getCallingUid());
|
||||||
} else if (sVerbose) {
|
} else if (sVerbose) {
|
||||||
Slog.v(TAG, "cancelSession(): no service for " + userId);
|
Slog.v(TAG, "cancelSession(): no service for " + userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disableOwnedAutofillServices(int userId) {
|
public void disableOwnedAutofillServices(int userId) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
|
final AutofillManagerServiceImpl service =
|
||||||
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
service.disableOwnedAutofillServicesLocked(Binder.getCallingUid());
|
service.disableOwnedAutofillServicesLocked(Binder.getCallingUid());
|
||||||
} else if (sVerbose) {
|
} else if (sVerbose) {
|
||||||
@@ -1867,21 +1984,36 @@ public final class AutofillManagerService
|
|||||||
@Override
|
@Override
|
||||||
public void isServiceSupported(int userId, @NonNull IResultReceiver receiver) {
|
public void isServiceSupported(int userId, @NonNull IResultReceiver receiver) {
|
||||||
boolean supported = false;
|
boolean supported = false;
|
||||||
synchronized (mLock) {
|
|
||||||
supported = !isDisabledLocked(userId);
|
try {
|
||||||
|
synchronized (mLock) {
|
||||||
|
supported = !isDisabledLocked(userId);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// Do not propagate exception
|
||||||
|
Log.wtf(TAG, "isServiceSupported(): failed " + ex.toString());
|
||||||
|
} finally {
|
||||||
|
send(receiver, supported);
|
||||||
}
|
}
|
||||||
send(receiver, supported);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void isServiceEnabled(int userId, @NonNull String packageName,
|
public void isServiceEnabled(int userId, @NonNull String packageName,
|
||||||
@NonNull IResultReceiver receiver) {
|
@NonNull IResultReceiver receiver) {
|
||||||
boolean enabled = false;
|
boolean enabled = false;
|
||||||
synchronized (mLock) {
|
|
||||||
final AutofillManagerServiceImpl service = getServiceForUserLocked(userId);
|
try {
|
||||||
enabled = Objects.equals(packageName, service.getServicePackageName());
|
synchronized (mLock) {
|
||||||
|
final AutofillManagerServiceImpl service =
|
||||||
|
peekServiceForUserWithLocalBinderIdentityLocked(userId);
|
||||||
|
enabled = Objects.equals(packageName, service.getServicePackageName());
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// Do not propagate exception
|
||||||
|
Log.wtf(TAG, "isServiceEnabled(): failed " + ex.toString());
|
||||||
|
} finally {
|
||||||
|
send(receiver, enabled);
|
||||||
}
|
}
|
||||||
send(receiver, enabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1891,8 +2023,9 @@ public final class AutofillManagerService
|
|||||||
|| operation == AutofillManager.PENDING_UI_OPERATION_RESTORE,
|
|| operation == AutofillManager.PENDING_UI_OPERATION_RESTORE,
|
||||||
"invalid operation: %d", operation);
|
"invalid operation: %d", operation);
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final AutofillManagerServiceImpl service = peekServiceForUserLocked(
|
final AutofillManagerServiceImpl service =
|
||||||
UserHandle.getCallingUserId());
|
peekServiceForUserWithLocalBinderIdentityLocked(
|
||||||
|
UserHandle.getCallingUserId());
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
service.onPendingSaveUi(operation, token);
|
service.onPendingSaveUi(operation, token);
|
||||||
}
|
}
|
||||||
@@ -1907,7 +2040,7 @@ public final class AutofillManagerService
|
|||||||
boolean uiOnly = false;
|
boolean uiOnly = false;
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
for (String arg : args) {
|
for (String arg : args) {
|
||||||
switch(arg) {
|
switch (arg) {
|
||||||
case "--no-history":
|
case "--no-history":
|
||||||
showHistory = false;
|
showHistory = false;
|
||||||
break;
|
break;
|
||||||
@@ -1934,27 +2067,38 @@ public final class AutofillManagerService
|
|||||||
try {
|
try {
|
||||||
sDebug = sVerbose = true;
|
sDebug = sVerbose = true;
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
pw.print("sDebug: "); pw.print(realDebug);
|
pw.print("sDebug: ");
|
||||||
pw.print(" sVerbose: "); pw.println(realVerbose);
|
pw.print(realDebug);
|
||||||
|
pw.print(" sVerbose: ");
|
||||||
|
pw.println(realVerbose);
|
||||||
pw.print("Flags: ");
|
pw.print("Flags: ");
|
||||||
synchronized (mFlagLock) {
|
synchronized (mFlagLock) {
|
||||||
pw.print("mPccClassificationEnabled="); pw.print(mPccClassificationEnabled);
|
pw.print("mPccClassificationEnabled=");
|
||||||
|
pw.print(mPccClassificationEnabled);
|
||||||
pw.print(";");
|
pw.print(";");
|
||||||
pw.print("mPccPreferProviderOverPcc="); pw.print(mPccPreferProviderOverPcc);
|
pw.print("mPccPreferProviderOverPcc=");
|
||||||
|
pw.print(mPccPreferProviderOverPcc);
|
||||||
pw.print(";");
|
pw.print(";");
|
||||||
pw.print("mPccUseFallbackDetection="); pw.print(mPccUseFallbackDetection);
|
pw.print("mPccUseFallbackDetection=");
|
||||||
|
pw.print(mPccUseFallbackDetection);
|
||||||
pw.print(";");
|
pw.print(";");
|
||||||
pw.print("mPccProviderHints="); pw.println(mPccProviderHints);
|
pw.print("mPccProviderHints=");
|
||||||
|
pw.println(mPccProviderHints);
|
||||||
}
|
}
|
||||||
// Dump per-user services
|
// Dump per-user services
|
||||||
dumpLocked("", pw);
|
dumpLocked("", pw);
|
||||||
mAugmentedAutofillResolver.dumpShort(pw); pw.println();
|
mAugmentedAutofillResolver.dumpShort(pw);
|
||||||
pw.print("Max partitions per session: "); pw.println(sPartitionMaxCount);
|
pw.println();
|
||||||
pw.print("Max visible datasets: "); pw.println(sVisibleDatasetsMaxCount);
|
pw.print("Max partitions per session: ");
|
||||||
|
pw.println(sPartitionMaxCount);
|
||||||
|
pw.print("Max visible datasets: ");
|
||||||
|
pw.println(sVisibleDatasetsMaxCount);
|
||||||
if (sFullScreenMode != null) {
|
if (sFullScreenMode != null) {
|
||||||
pw.print("Overridden full-screen mode: "); pw.println(sFullScreenMode);
|
pw.print("Overridden full-screen mode: ");
|
||||||
|
pw.println(sFullScreenMode);
|
||||||
}
|
}
|
||||||
pw.println("User data constraints: "); UserData.dumpConstraints(prefix, pw);
|
pw.println("User data constraints: ");
|
||||||
|
UserData.dumpConstraints(prefix, pw);
|
||||||
mUi.dump(pw);
|
mUi.dump(pw);
|
||||||
pw.print("Autofill Compat State: ");
|
pw.print("Autofill Compat State: ");
|
||||||
mAutofillCompatState.dump(prefix, pw);
|
mAutofillCompatState.dump(prefix, pw);
|
||||||
@@ -1969,11 +2113,17 @@ public final class AutofillManagerService
|
|||||||
pw.print("Augmented Service Request Timeout: ");
|
pw.print("Augmented Service Request Timeout: ");
|
||||||
pw.println(mAugmentedServiceRequestTimeoutMs);
|
pw.println(mAugmentedServiceRequestTimeoutMs);
|
||||||
if (showHistory) {
|
if (showHistory) {
|
||||||
pw.println(); pw.println("Requests history:"); pw.println();
|
pw.println();
|
||||||
|
pw.println("Requests history:");
|
||||||
|
pw.println();
|
||||||
mRequestsHistory.reverseDump(fd, pw, args);
|
mRequestsHistory.reverseDump(fd, pw, args);
|
||||||
pw.println(); pw.println("UI latency history:"); pw.println();
|
pw.println();
|
||||||
|
pw.println("UI latency history:");
|
||||||
|
pw.println();
|
||||||
mUiLatencyHistory.reverseDump(fd, pw, args);
|
mUiLatencyHistory.reverseDump(fd, pw, args);
|
||||||
pw.println(); pw.println("WTF history:"); pw.println();
|
pw.println();
|
||||||
|
pw.println("WTF history:");
|
||||||
|
pw.println();
|
||||||
mWtfHistory.reverseDump(fd, pw, args);
|
mWtfHistory.reverseDump(fd, pw, args);
|
||||||
}
|
}
|
||||||
pw.println("Augmented Autofill State: ");
|
pw.println("Augmented Autofill State: ");
|
||||||
|
|||||||
Reference in New Issue
Block a user