Report unhandled exceptions for Play store installs only

This commit is contained in:
M66B 2017-11-09 16:24:37 +01:00
parent c97958c072
commit eb4a7ff1f9
2 changed files with 10 additions and 2 deletions

View File

@ -47,7 +47,10 @@ public class ApplicationEx extends Application {
@Override
public void uncaughtException(Thread thread, Throwable ex) {
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
System.exit(1);
if (Util.isPlayStoreInstall(ApplicationEx.this))
mPrevHandler.uncaughtException(thread, ex);
else
System.exit(1);
}
});
}

View File

@ -415,7 +415,12 @@ public class Util {
}
public static boolean isPlayStoreInstall(Context context) {
return "com.android.vending".equals(context.getPackageManager().getInstallerPackageName(context.getPackageName()));
try {
return "com.android.vending".equals(context.getPackageManager().getInstallerPackageName(context.getPackageName()));
} catch (Throwable ex) {
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
return false;
}
}
public static boolean hasPlayServices(Context context) {