Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eb93c6a6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes Ia706a503,I04f245ac

* changes:
  Fix potential null package name
  Add log when denying client authorization state
parents 971edda3 2b69e2cf
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -322,6 +322,17 @@ public class ContextHubClientBroker extends IContextHubClient.Stub
        } else {
            mPendingIntentRequest = new PendingIntentRequest(pendingIntent, nanoAppId);
        }

        if (packageName == null) {
            String[] packages = mContext.getPackageManager().getPackagesForUid(
                    Binder.getCallingUid());
            if (packages != null && packages.length > 0) {
                packageName = packages[0];
            }
            Log.e(TAG, "createClient: Provided package name null. Using first package name "
                    + packageName);
        }

        mPackage = packageName;
        mAttributionTag = attributionTag;
        mTransactionManager = transactionManager;
+3 −0
Original line number Diff line number Diff line
@@ -1042,6 +1042,9 @@ public class ContextHubService extends IContextHubService.Stub {
    }

    /* package */ void denyClientAuthState(int contextHubId, String packageName, long nanoAppId) {
        Log.i(TAG, "Denying " + packageName + " access to " + Long.toHexString(nanoAppId)
                + " on context hub # " + contextHubId);

        mClientManager.forEachClientOfHub(contextHubId, client -> {
            if (client.getPackageName().equals(packageName)) {
                client.updateNanoAppAuthState(