Skip to content

Commit

Permalink
Merge "cmsdk: fix cannot create handler" into cm-12.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Adnan Begovic authored and Gerrit Code Review committed Jul 13, 2015
2 parents eddb89c + 6df8a83 commit de36b88
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Expand Up @@ -29,6 +29,7 @@
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;
Expand Down Expand Up @@ -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;
Expand All @@ -100,6 +102,7 @@ public void onReceive(Context context, Intent intent) {
public ProfileManagerService(Context context) {
super(context);
mContext = context;
mHandler = new Handler();
publishBinderService(CMContextConstants.CM_PROFILE_SERVICE, mService);
}

Expand All @@ -125,7 +128,7 @@ private void initialize() {
}

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>();
Expand Down
Expand Up @@ -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();
Expand Down

0 comments on commit de36b88

Please sign in to comment.