Fix location settings crash when work profile is disabled
am: 3bd4771
* commit '3bd4771ccb6f05c30cf7de6b2092f4f580821b56':
Fix location settings crash when work profile is disabled
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.location;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
@@ -474,6 +475,15 @@ class SettingsInjector {
|
||||
* preference when the service replies.
|
||||
*/
|
||||
public void startService() {
|
||||
final ActivityManager am = (ActivityManager)
|
||||
mContext.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
if (!am.isUserRunning(setting.mUserHandle.getIdentifier())) {
|
||||
if (Log.isLoggable(TAG, Log.VERBOSE)) {
|
||||
Log.v(TAG, "Cannot start service as user "
|
||||
+ setting.mUserHandle.getIdentifier() + " is not running");
|
||||
}
|
||||
return;
|
||||
}
|
||||
Handler handler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
|
Reference in New Issue
Block a user