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

Commit b381789f authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Tighten up Binder.clearCallingIdentity() usage.

This is a second CL in a chain that fixes minor fallout from the
previous CL which was purely mechanical.

Bug: 155703208
Test: make
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: I38e924a8061dc7a1194003412c46df29c13fb035
parent 2d2e07e2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2865,11 +2865,11 @@ public class AccountManagerService
        // Get the calling package. We will use it for the purpose of caching.
        final String callerPkg = loginOptions.getString(AccountManager.KEY_ANDROID_PACKAGE_NAME);
        List<String> callerOwnedPackageNames;
        ident = Binder.clearCallingIdentity();
        final long ident2 = Binder.clearCallingIdentity();
        try {
            callerOwnedPackageNames = Arrays.asList(mPackageManager.getPackagesForUid(callerUid));
        } finally {
            Binder.restoreCallingIdentity(ident);
            Binder.restoreCallingIdentity(ident2);
        }
        if (callerPkg == null || !callerOwnedPackageNames.contains(callerPkg)) {
            String msg = String.format(
+2 −2
Original line number Diff line number Diff line
@@ -879,11 +879,11 @@ public class NotificationManagerService extends SystemService {
                        Binder.restoreCallingIdentity(identity);
                    }

                    identity = Binder.clearCallingIdentity();
                    final long identity2 = Binder.clearCallingIdentity();
                    try {
                        mVibrator.cancel();
                    } finally {
                        Binder.restoreCallingIdentity(identity);
                        Binder.restoreCallingIdentity(identity2);
                    }
                }
            }