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

Commit ed3a0a78 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android (Google) Code Review
Browse files

Merge "Fix crash in bindService due to uncleared binder identity"

parents f91e74d9 8fb0e194
Loading
Loading
Loading
Loading
+14 −9
Original line number Original line Diff line number Diff line
@@ -1094,8 +1094,10 @@ public final class ActiveServices {
                }
                }
                r = smap.mServicesByName.get(name);
                r = smap.mServicesByName.get(name);
                if (r == null && createIfNeeded) {
                if (r == null && createIfNeeded) {
                    // Before going further -- if this app is not allowed to run in the background,
                    final long token = Binder.clearCallingIdentity();
                    // then at this point we aren't going to let it period.
                    try {
                        // Before going further -- if this app is not allowed to run in the
                        // background, then at this point we aren't going to let it period.
                        if (!mAm.checkAllowBackgroundLocked(sInfo.applicationInfo.uid,
                        if (!mAm.checkAllowBackgroundLocked(sInfo.applicationInfo.uid,
                                sInfo.packageName, callingPid)) {
                                sInfo.packageName, callingPid)) {
                            Slog.w(TAG, "Background execution not allowed: service "
                            Slog.w(TAG, "Background execution not allowed: service "
@@ -1104,6 +1106,9 @@ public final class ActiveServices {
                                    + " pkg=" + callingPackage);
                                    + " pkg=" + callingPackage);
                            return null;
                            return null;
                        }
                        }
                    } finally {
                        Binder.restoreCallingIdentity(token);
                    }


                    Intent.FilterComparison filter
                    Intent.FilterComparison filter
                            = new Intent.FilterComparison(service.cloneFilter());
                            = new Intent.FilterComparison(service.cloneFilter());