Commit a6aca040 authored by Sergey Galin's avatar Sergey Galin

Update error handling

parent 448297d2
......@@ -70,8 +70,12 @@ public class OrientationProvider implements SensorEventListener {
try {
// initialize your android device sensor capabilities
mSensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mMagnetometer = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
if (mSensorManager != null) {
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mMagnetometer = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
} else {
Log.w(TAG, "SensorManager is null!");
}
} catch (final Throwable e) {
Log.e(TAG, "Exception while getting sensors: ", e);
}
......@@ -141,8 +145,8 @@ public class OrientationProvider implements SensorEventListener {
mSensorManager.unregisterListener(this);
mRegistered = false;
}
catch(Exception e) {
Log.e(TAG, "Failed to stop orientation listener", e);
catch(final Throwable e) {
Log.e(TAG, "Failed to stop orientation listener: ", e);
}
}
......@@ -164,8 +168,11 @@ public class OrientationProvider implements SensorEventListener {
} else if (Surface.ROTATION_270 == rotation) {
angleShift = 270;
}
} catch (Throwable e) {
Log.e(TAG, "Failed to get rotation", e);
} catch (final RuntimeException e) {
// Most likely cause: android.os.DeadSystemException
Log.e(TAG, "Failed to get rotation due to RuntimeException: " + e);
} catch (final Throwable e) {
Log.e(TAG, "Failed to get rotation: ", e);
}
}
......@@ -211,6 +218,7 @@ public class OrientationProvider implements SensorEventListener {
// "mOrientationAngles" now has up-to-date information.
}
private native Activity getActivity();
private native void onUpdate(long nativeptr);
};
......
......@@ -294,12 +294,15 @@ public class GmsLocationProvider implements ConnectionCallbacks, OnConnectionFai
}
});
}
} catch (IllegalStateException e) {
Log.e(TAG, "Failed to connect GoogleApiClient, incorrect looper: ", e);
} catch (SecurityException e) {
Log.e(TAG, "Failed to connect GoogleApiClient, no permissions: ", e);
} catch (Exception e) {
Log.e(TAG, "Failed to connect GoogleApiClient: ", e);
} catch (final IllegalStateException e) {
Log.e(TAG, "Failed to connect to GoogleApiClient, incorrect looper: ", e);
} catch (final SecurityException e) {
// Most likely cause:
// "Client must have ACCESS_FINE_LOCATION permission to request PRIORITY_HIGH_ACCURACY locations."
// due to some async problem with a minority of users.
Log.e(TAG, "Failed to connect to GoogleApiClient, no permissions: " + e);
} catch (final Throwable e) {
Log.e(TAG, "Failed to connect to GoogleApiClient: ", e);
}
}
......
......@@ -1378,7 +1378,8 @@ public abstract class OffscreenView
}
catch (final Throwable e)
{
Log.e(TAG, "Failed to lock canvas for "+object_name_, e);
// Happens rarely, mostly on Android 4. Visual effects unknown.
Log.e(TAG, "Failed to lock canvas for " + object_name_ + ": " + e);
return null;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment