CMSDK: Make sure to initialize ProfileTriggerHelper.
OSS-JIRA: NIGHTLIES-1480 Change-Id: I48fbb350d96424b593858aca1b2343a79f298b0c
This commit is contained in:
parent
4334b3d969
commit
cc979035e7
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011-2014 CyanogenMod Project
|
* Copyright (c) 2011-2015 CyanogenMod Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -82,6 +82,7 @@ public class ProfileManagerService extends SystemService {
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private boolean mDirty;
|
private boolean mDirty;
|
||||||
private BackupManager mBackupManager;
|
private BackupManager mBackupManager;
|
||||||
|
private ProfileTriggerHelper mTriggerHelper;
|
||||||
|
|
||||||
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -124,6 +125,7 @@ public class ProfileManagerService extends SystemService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialize(boolean skipFile) {
|
private void initialize(boolean skipFile) {
|
||||||
|
mTriggerHelper = new ProfileTriggerHelper(mContext, this);
|
||||||
mProfiles = new HashMap<UUID, Profile>();
|
mProfiles = new HashMap<UUID, Profile>();
|
||||||
mProfileNames = new HashMap<String, UUID>();
|
mProfileNames = new HashMap<String, UUID>();
|
||||||
mGroups = new HashMap<UUID, NotificationGroup>();
|
mGroups = new HashMap<UUID, NotificationGroup>();
|
||||||
|
@ -221,7 +223,7 @@ public class ProfileManagerService extends SystemService {
|
||||||
@Override
|
@Override
|
||||||
public Profile getProfile(ParcelUuid profileParcelUuid) {
|
public Profile getProfile(ParcelUuid profileParcelUuid) {
|
||||||
UUID profileUuid = profileParcelUuid.getUuid();
|
UUID profileUuid = profileParcelUuid.getUuid();
|
||||||
return internalGetProfile(profileUuid);
|
return getProfileInternal(profileUuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -233,7 +235,7 @@ public class ProfileManagerService extends SystemService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Profile getActiveProfile() {
|
public Profile getActiveProfile() {
|
||||||
return mActiveProfile;
|
return getActiveProfileInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -394,7 +396,7 @@ public class ProfileManagerService extends SystemService {
|
||||||
profile.addProfileGroup(new ProfileGroup(group.getUuid(), defaultGroup));
|
profile.addProfileGroup(new ProfileGroup(group.getUuid(), defaultGroup));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Profile internalGetProfile(UUID profileUuid) {
|
private Profile getProfileInternal(UUID profileUuid) {
|
||||||
// use primary UUID first
|
// use primary UUID first
|
||||||
if (mProfiles.containsKey(profileUuid)) {
|
if (mProfiles.containsKey(profileUuid)) {
|
||||||
return mProfiles.get(profileUuid);
|
return mProfiles.get(profileUuid);
|
||||||
|
@ -556,6 +558,10 @@ public class ProfileManagerService extends SystemService {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* package */ Profile getActiveProfileInternal() {
|
||||||
|
return mActiveProfile;
|
||||||
|
}
|
||||||
|
|
||||||
/* package */ void setActiveProfileInternal(Profile newActiveProfile, boolean doInit) {
|
/* package */ void setActiveProfileInternal(Profile newActiveProfile, boolean doInit) {
|
||||||
/*
|
/*
|
||||||
* NOTE: Since this is not a public function, and all public functions
|
* NOTE: Since this is not a public function, and all public functions
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cyanogenmod.app;
|
package org.cyanogenmod.platform.internal;
|
||||||
|
|
||||||
import android.bluetooth.BluetoothDevice;
|
import android.bluetooth.BluetoothDevice;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
|
@ -29,13 +29,20 @@ import android.os.Handler;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import cyanogenmod.app.Profile;
|
||||||
|
|
||||||
|
import org.cyanogenmod.platform.internal.ProfileManagerService;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
public class ProfileTriggerHelper extends BroadcastReceiver {
|
public class ProfileTriggerHelper extends BroadcastReceiver {
|
||||||
private static final String TAG = "ProfileTriggerHelper";
|
private static final String TAG = "ProfileTriggerHelper";
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private ProfileManager mManager;
|
private ProfileManagerService mManagerService;
|
||||||
|
|
||||||
private WifiManager mWifiManager;
|
private WifiManager mWifiManager;
|
||||||
private String mLastConnectedSSID;
|
private String mLastConnectedSSID;
|
||||||
|
@ -50,9 +57,9 @@ public class ProfileTriggerHelper extends BroadcastReceiver {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public ProfileTriggerHelper(Context context, ProfileManager manager) {
|
public ProfileTriggerHelper(Context context, ProfileManagerService profileManagerService) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mManager = manager;
|
mManagerService = profileManagerService;
|
||||||
|
|
||||||
mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
|
mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
|
||||||
mLastConnectedSSID = getActiveSSID();
|
mLastConnectedSSID = getActiveSSID();
|
||||||
|
@ -118,16 +125,16 @@ public class ProfileTriggerHelper extends BroadcastReceiver {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkTriggers(int type, String id, int newState) {
|
private void checkTriggers(int type, String id, int newState) {
|
||||||
/*for (Profile p : mManager.getProfileList()) {
|
for (Profile p : mManagerService.getProfileList()) {
|
||||||
if (newState != p.getTrigger(type, id)) {
|
if (newState != p.getTrigger(type, id)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID currentProfileUuid = mManager.getActiveProfile().getUuid();
|
UUID currentProfileUuid = mManagerService.getActiveProfileInternal().getUuid();
|
||||||
if (!currentProfileUuid.equals(p.getUuid())) {
|
if (!currentProfileUuid.equals(p.getUuid())) {
|
||||||
//mManager.setActiveProfile(p, true);
|
mManagerService.setActiveProfileInternal(p, true);
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getActiveSSID() {
|
private String getActiveSSID() {
|
Loading…
Reference in New Issue