Merge "Fix the translation doesn't work" into udc-dev am: 83b5bfc0eb am: c7d320e62e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22085791 Change-Id: I0892b5d191c4d7e4e5a1c09cecc8599af922f668 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -37,6 +37,7 @@ import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.IRemoteCallback;
|
||||
@@ -160,11 +161,20 @@ final class TranslationManagerServiceImpl extends
|
||||
return null;
|
||||
}
|
||||
final ComponentName serviceComponent = ComponentName.unflattenFromString(serviceName);
|
||||
if (!isServiceAvailableForUser(serviceComponent)) {
|
||||
boolean isServiceAvailableForUser;
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
isServiceAvailableForUser = isServiceAvailableForUser(serviceComponent);
|
||||
if (mMaster.verbose) {
|
||||
Slog.v(TAG, "ensureRemoteServiceLocked(): " + serviceComponent
|
||||
+ " is not available,");
|
||||
Slog.v(TAG, "ensureRemoteServiceLocked(): isServiceAvailableForUser="
|
||||
+ isServiceAvailableForUser);
|
||||
}
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
if (!isServiceAvailableForUser) {
|
||||
Slog.w(TAG, "ensureRemoteServiceLocked(): " + serviceComponent
|
||||
+ " is not available,");
|
||||
return null;
|
||||
}
|
||||
mRemoteTranslationService = new RemoteTranslationService(getContext(), serviceComponent,
|
||||
|
||||
Reference in New Issue
Block a user