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

Commit 826a1848 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Clear callingId before binder calls in CompatChanges" am: 45d1f67b...

Merge "Clear callingId before binder calls in CompatChanges" am: 45d1f67b am: 00f11fe5 am: 912f8487

Change-Id: I8dc566e8d2fb1c8604f686298867f5a451e480b9
parents ccaa328a 912f8487
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
import android.compat.Compatibility;
import android.compat.Compatibility;
import android.content.Context;
import android.content.Context;
import android.os.Binder;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.UserHandle;
@@ -70,11 +71,14 @@ public final class CompatChanges {
            @NonNull UserHandle user) {
            @NonNull UserHandle user) {
        IPlatformCompat platformCompat = IPlatformCompat.Stub.asInterface(
        IPlatformCompat platformCompat = IPlatformCompat.Stub.asInterface(
                ServiceManager.getService(Context.PLATFORM_COMPAT_SERVICE));
                ServiceManager.getService(Context.PLATFORM_COMPAT_SERVICE));
        final long token = Binder.clearCallingIdentity();
        try {
        try {
            return platformCompat.isChangeEnabledByPackageName(changeId, packageName,
            return platformCompat.isChangeEnabledByPackageName(changeId, packageName,
                    user.getIdentifier());
                    user.getIdentifier());
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        } finally {
            Binder.restoreCallingIdentity(token);
        }
        }
    }
    }


@@ -99,10 +103,13 @@ public final class CompatChanges {
    public static boolean isChangeEnabled(long changeId, int uid) {
    public static boolean isChangeEnabled(long changeId, int uid) {
        IPlatformCompat platformCompat = IPlatformCompat.Stub.asInterface(
        IPlatformCompat platformCompat = IPlatformCompat.Stub.asInterface(
                ServiceManager.getService(Context.PLATFORM_COMPAT_SERVICE));
                ServiceManager.getService(Context.PLATFORM_COMPAT_SERVICE));
        final long token = Binder.clearCallingIdentity();
        try {
        try {
            return platformCompat.isChangeEnabledByUid(changeId, uid);
            return platformCompat.isChangeEnabledByUid(changeId, uid);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        } finally {
            Binder.restoreCallingIdentity(token);
        }
        }
    }
    }
}
}