diff options
-rw-r--r-- | cm/lib/main/java/org/cyanogenmod/platform/internal/ProfileManagerService.java | 5 | ||||
-rw-r--r-- | cm/lib/main/java/org/cyanogenmod/platform/internal/ProfileTriggerHelper.java | 13 |
2 files changed, 14 insertions, 4 deletions
diff --git a/cm/lib/main/java/org/cyanogenmod/platform/internal/ProfileManagerService.java b/cm/lib/main/java/org/cyanogenmod/platform/internal/ProfileManagerService.java index e6f7f8e..a533963 100644 --- a/cm/lib/main/java/org/cyanogenmod/platform/internal/ProfileManagerService.java +++ b/cm/lib/main/java/org/cyanogenmod/platform/internal/ProfileManagerService.java @@ -29,6 +29,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.res.XmlResourceParser; import android.os.Environment; +import android.os.Handler; import android.os.UserHandle; import android.os.IBinder; import android.text.TextUtils; @@ -80,6 +81,7 @@ public class ProfileManagerService extends SystemService { private NotificationGroup mWildcardGroup; private Context mContext; + private Handler mHandler; private boolean mDirty; private BackupManager mBackupManager; private ProfileTriggerHelper mTriggerHelper; @@ -100,6 +102,7 @@ public class ProfileManagerService extends SystemService { public ProfileManagerService(Context context) { super(context); mContext = context; + mHandler = new Handler(); publishBinderService(CMContextConstants.CM_PROFILE_SERVICE, mService); } @@ -125,7 +128,7 @@ public class ProfileManagerService extends SystemService { } private void initialize(boolean skipFile) { - mTriggerHelper = new ProfileTriggerHelper(mContext, this); + mTriggerHelper = new ProfileTriggerHelper(mContext, mHandler, this); mProfiles = new HashMap<UUID, Profile>(); mProfileNames = new HashMap<String, UUID>(); mGroups = new HashMap<UUID, NotificationGroup>(); diff --git a/cm/lib/main/java/org/cyanogenmod/platform/internal/ProfileTriggerHelper.java b/cm/lib/main/java/org/cyanogenmod/platform/internal/ProfileTriggerHelper.java index 2e7e4c4..8ad6098 100644 --- a/cm/lib/main/java/org/cyanogenmod/platform/internal/ProfileTriggerHelper.java +++ b/cm/lib/main/java/org/cyanogenmod/platform/internal/ProfileTriggerHelper.java @@ -50,16 +50,23 @@ public class ProfileTriggerHelper extends BroadcastReceiver { private IntentFilter mIntentFilter; private boolean mFilterRegistered = false; - private ContentObserver mSettingsObserver = new ContentObserver(new Handler()) { + private class SettingsObserver extends ContentObserver { + public SettingsObserver(Handler handler) { + super(handler); + } + @Override public void onChange(boolean selfChange) { updateEnabled(); } - }; + } + private final ContentObserver mSettingsObserver; - public ProfileTriggerHelper(Context context, ProfileManagerService profileManagerService) { + public ProfileTriggerHelper(Context context, Handler handler, + ProfileManagerService profileManagerService) { mContext = context; mManagerService = profileManagerService; + mSettingsObserver = new SettingsObserver(handler); mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); mLastConnectedSSID = getActiveSSID(); |