Merge "Use userId 0 to bind the DisplayHashingService" into sc-dev am: b91aa916c0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15189990 Change-Id: I97df1ac726426b2ad9ff995bf6b2c66392877615
This commit is contained in:
@@ -47,7 +47,6 @@ import android.os.Looper;
|
|||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.RemoteCallback;
|
import android.os.RemoteCallback;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.UserHandle;
|
|
||||||
import android.service.displayhash.DisplayHashParams;
|
import android.service.displayhash.DisplayHashParams;
|
||||||
import android.service.displayhash.DisplayHashingService;
|
import android.service.displayhash.DisplayHashingService;
|
||||||
import android.service.displayhash.IDisplayHashingService;
|
import android.service.displayhash.IDisplayHashingService;
|
||||||
@@ -380,8 +379,7 @@ public class DisplayHashController {
|
|||||||
intent.setComponent(component);
|
intent.setComponent(component);
|
||||||
final long token = Binder.clearCallingIdentity();
|
final long token = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
mContext.bindServiceAsUser(intent, mServiceConnection,
|
mContext.bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE);
|
||||||
Context.BIND_AUTO_CREATE, UserHandle.CURRENT);
|
|
||||||
if (DEBUG) Slog.v(TAG, "bound");
|
if (DEBUG) Slog.v(TAG, "bound");
|
||||||
} finally {
|
} finally {
|
||||||
Binder.restoreCallingIdentity(token);
|
Binder.restoreCallingIdentity(token);
|
||||||
@@ -404,8 +402,15 @@ public class DisplayHashController {
|
|||||||
|
|
||||||
final Intent intent = new Intent(DisplayHashingService.SERVICE_INTERFACE);
|
final Intent intent = new Intent(DisplayHashingService.SERVICE_INTERFACE);
|
||||||
intent.setPackage(packageName);
|
intent.setPackage(packageName);
|
||||||
final ResolveInfo resolveInfo = mContext.getPackageManager().resolveService(intent,
|
final ResolveInfo resolveInfo;
|
||||||
PackageManager.GET_SERVICES | PackageManager.GET_META_DATA);
|
final long token = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
|
resolveInfo = mContext.getPackageManager().resolveService(intent,
|
||||||
|
PackageManager.GET_SERVICES | PackageManager.GET_META_DATA);
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
|
|
||||||
if (resolveInfo == null || resolveInfo.serviceInfo == null) {
|
if (resolveInfo == null || resolveInfo.serviceInfo == null) {
|
||||||
Slog.w(TAG, "No valid components found.");
|
Slog.w(TAG, "No valid components found.");
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user