cmsdk: fix cannot create handler

Change-Id: I34153f6199d46b7fa9a914efa38552b8d66c0c99
JIRA: NIGHTLIES-1532
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
This commit is contained in:
Jorge Ruesga 2015-07-14 00:10:23 +02:00 committed by Adnan Begovic
parent eddb89c527
commit 63524972a3
2 changed files with 14 additions and 4 deletions

View File

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

View File

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