diff options
| author | 2023-03-16 02:16:25 +0000 | |
|---|---|---|
| committer | 2023-03-16 02:16:25 +0000 | |
| commit | 83b5bfc0eba7d0bd329c95cd21a8ffb99a85a872 (patch) | |
| tree | 561333afe462fa3dff7e1133936001df18c0a430 | |
| parent | 0003196b1a2258d985ee4e5bc04de9c8be157505 (diff) | |
| parent | 3cf6c66fddadff10803ca17264ae9e6e7baa1af4 (diff) | |
Merge "Fix the translation doesn't work" into udc-dev
| -rw-r--r-- | services/translation/java/com/android/server/translation/TranslationManagerServiceImpl.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/services/translation/java/com/android/server/translation/TranslationManagerServiceImpl.java b/services/translation/java/com/android/server/translation/TranslationManagerServiceImpl.java index 2d382a27d747..79046db04d1b 100644 --- a/services/translation/java/com/android/server/translation/TranslationManagerServiceImpl.java +++ b/services/translation/java/com/android/server/translation/TranslationManagerServiceImpl.java @@ -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, |