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

Commit 3b1534f6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Don't obscure system_server crashes" into tm-dev am: dec64e74

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17034531

Change-Id: Ibf9eaeac0bc226b907b3c76087562eebe1f3b3d7
parents 7de96081 dec64e74
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.server.location.geofence;
import static android.location.LocationManager.FUSED_PROVIDER;
import static android.location.LocationManager.FUSED_PROVIDER;
import static android.location.LocationManager.KEY_PROXIMITY_ENTERING;
import static android.location.LocationManager.KEY_PROXIMITY_ENTERING;


import static com.android.internal.util.ConcurrentUtils.DIRECT_EXECUTOR;
import static com.android.server.location.LocationPermissions.PERMISSION_FINE;
import static com.android.server.location.LocationPermissions.PERMISSION_FINE;


import android.annotation.Nullable;
import android.annotation.Nullable;
@@ -41,6 +40,7 @@ import android.stats.location.LocationStatsEnums;
import android.util.ArraySet;
import android.util.ArraySet;


import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.GuardedBy;
import com.android.server.FgThread;
import com.android.server.PendingIntentUtils;
import com.android.server.PendingIntentUtils;
import com.android.server.location.LocationPermissions;
import com.android.server.location.LocationPermissions;
import com.android.server.location.injector.Injector;
import com.android.server.location.injector.Injector;
@@ -396,7 +396,7 @@ public class GeofenceManager extends
    protected boolean registerWithService(LocationRequest locationRequest,
    protected boolean registerWithService(LocationRequest locationRequest,
            Collection<GeofenceRegistration> registrations) {
            Collection<GeofenceRegistration> registrations) {
        getLocationManager().requestLocationUpdates(FUSED_PROVIDER, locationRequest,
        getLocationManager().requestLocationUpdates(FUSED_PROVIDER, locationRequest,
                DIRECT_EXECUTOR, this);
                FgThread.getExecutor(), this);
        return true;
        return true;
    }
    }


+56 −7
Original line number Original line Diff line number Diff line
@@ -201,18 +201,54 @@ public class LocationProviderManager extends
        @Override
        @Override
        public void deliverOnLocationChanged(LocationResult locationResult,
        public void deliverOnLocationChanged(LocationResult locationResult,
                @Nullable IRemoteCallback onCompleteCallback) throws RemoteException {
                @Nullable IRemoteCallback onCompleteCallback) throws RemoteException {
            try {
                mListener.onLocationChanged(locationResult.asList(), onCompleteCallback);
                mListener.onLocationChanged(locationResult.asList(), onCompleteCallback);
            } catch (RuntimeException e) {
                // the only way a runtime exception can be thrown here is if the client is in the
                // system server process (so that the binder call is executed directly, rather than
                // asynchronously in another process), and the client is using a direct executor (so
                // any client exceptions bubble directly back to us). we move any exception onto
                // another thread so that it can't cause further problems
                RuntimeException wrapper = new RuntimeException(e);
                FgThread.getExecutor().execute(() -> {
                    throw wrapper;
                });
            }
        }
        }


        @Override
        @Override
        public void deliverOnFlushComplete(int requestCode) throws RemoteException {
        public void deliverOnFlushComplete(int requestCode) throws RemoteException {
            try {
                mListener.onFlushComplete(requestCode);
                mListener.onFlushComplete(requestCode);
            } catch (RuntimeException e) {
                // the only way a runtime exception can be thrown here is if the client is in the
                // system server process (so that the binder call is executed directly, rather than
                // asynchronously in another process), and the client is using a direct executor (so
                // any client exceptions bubble directly back to us). we move any exception onto
                // another thread so that it can't cause further problems
                RuntimeException wrapper = new RuntimeException(e);
                FgThread.getExecutor().execute(() -> {
                    throw wrapper;
                });
            }
        }
        }


        @Override
        @Override
        public void deliverOnProviderEnabledChanged(String provider, boolean enabled)
        public void deliverOnProviderEnabledChanged(String provider, boolean enabled)
                throws RemoteException {
                throws RemoteException {
            try {
                mListener.onProviderEnabledChanged(provider, enabled);
                mListener.onProviderEnabledChanged(provider, enabled);
            } catch (RuntimeException e) {
                // the only way a runtime exception can be thrown here is if the client is in the
                // system server process (so that the binder call is executed directly, rather than
                // asynchronously in another process), and the client is using a direct executor (so
                // any client exceptions bubble directly back to us). we move any exception onto
                // another thread so that it can't cause further problems
                RuntimeException wrapper = new RuntimeException(e);
                FgThread.getExecutor().execute(() -> {
                    throw wrapper;
                });
            }
        }
        }
    }
    }


@@ -294,11 +330,24 @@ public class LocationProviderManager extends
                throws RemoteException {
                throws RemoteException {
            // ILocationCallback doesn't currently support completion callbacks
            // ILocationCallback doesn't currently support completion callbacks
            Preconditions.checkState(onCompleteCallback == null);
            Preconditions.checkState(onCompleteCallback == null);

            try {
                if (locationResult != null) {
                if (locationResult != null) {
                    mCallback.onLocation(locationResult.getLastLocation());
                    mCallback.onLocation(locationResult.getLastLocation());
                } else {
                } else {
                    mCallback.onLocation(null);
                    mCallback.onLocation(null);
                }
                }
            } catch (RuntimeException e) {
                // the only way a runtime exception can be thrown here is if the client is in the
                // system server process (so that the binder call is executed directly, rather than
                // asynchronously in another process), and the client is using a direct executor (so
                // any client exceptions bubble directly back to us). we move any exception onto
                // another thread so that it can't cause further problems
                RuntimeException wrapper = new RuntimeException(e);
                FgThread.getExecutor().execute(() -> {
                    throw wrapper;
                });
            }
        }
        }


        @Override
        @Override