cmsdk: Create CMSystemServer to handle our platform init.
Change-Id: I7b62978e2a284a3a1ec1ffc1d8c72545d7b0c939
This commit is contained in:
parent
970f0b6e95
commit
b51572d697
|
@ -26,13 +26,12 @@ import com.android.server.SystemService;
|
|||
import cyanogenmod.app.CMContextConstants;
|
||||
import cyanogenmod.app.suggest.ApplicationSuggestion;
|
||||
import cyanogenmod.app.suggest.IAppSuggestManager;
|
||||
import cyanogenmod.platform.Manifest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/** @hide */
|
||||
public class AppSuggestManagerService extends SystemService {
|
||||
public class AppSuggestManagerService extends CMSystemService {
|
||||
private static final String TAG = "AppSgstMgrService";
|
||||
public static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
|
||||
|
@ -62,6 +61,11 @@ public class AppSuggestManagerService extends SystemService {
|
|||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFeatureDeclaration() {
|
||||
return CMContextConstants.Features.APP_SUGGEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
mImpl = AppSuggestProviderProxy.createAndBind(mContext, TAG, ACTION,
|
||||
|
@ -73,13 +77,6 @@ public class AppSuggestManagerService extends SystemService {
|
|||
} else {
|
||||
Slog.i(TAG, "Bound to to suggest provider");
|
||||
}
|
||||
|
||||
if (mContext.getPackageManager().hasSystemFeature(
|
||||
CMContextConstants.Features.APP_SUGGEST)) {
|
||||
publishBinderService(CMContextConstants.CM_APP_SUGGEST_SERVICE, mService);
|
||||
} else {
|
||||
Log.wtf(TAG, "CM hardware service started by system server but feature xml not" +
|
||||
" declared. Not publishing binder service!");
|
||||
}
|
||||
publishBinderService(CMContextConstants.CM_APP_SUGGEST_SERVICE, mService);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ import cyanogenmod.media.CMAudioManager;
|
|||
import cyanogenmod.media.ICMAudioService;
|
||||
import cyanogenmod.platform.Manifest;
|
||||
|
||||
public class CMAudioService extends SystemService {
|
||||
public class CMAudioService extends CMSystemService {
|
||||
|
||||
private static final String TAG = "CMAudioService";
|
||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
|
@ -55,14 +55,12 @@ public class CMAudioService extends SystemService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
if (!mContext.getPackageManager().hasSystemFeature(
|
||||
CMContextConstants.Features.AUDIO)) {
|
||||
Log.wtf(TAG, "CM Audio service started by system server but feature xml not" +
|
||||
" declared. Not publishing binder service!");
|
||||
return;
|
||||
}
|
||||
public String getFeatureDeclaration() {
|
||||
return CMContextConstants.Features.AUDIO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
if (!NativeHelper.isNativeLibraryAvailable()) {
|
||||
Log.wtf(TAG, "CM Audio service started by system server by native library is" +
|
||||
"unavailable. Service will be unavailable.");
|
||||
|
|
|
@ -54,7 +54,7 @@ import org.cyanogenmod.hardware.UniqueDeviceId;
|
|||
import org.cyanogenmod.hardware.VibratorHW;
|
||||
|
||||
/** @hide */
|
||||
public class CMHardwareService extends SystemService implements ThermalUpdateCallback {
|
||||
public class CMHardwareService extends CMSystemService implements ThermalUpdateCallback {
|
||||
|
||||
private static final boolean DEBUG = true;
|
||||
private static final String TAG = CMHardwareService.class.getSimpleName();
|
||||
|
@ -344,13 +344,12 @@ public class CMHardwareService extends SystemService implements ThermalUpdateCal
|
|||
super(context);
|
||||
mContext = context;
|
||||
mCmHwImpl = getImpl(context);
|
||||
if (context.getPackageManager().hasSystemFeature(
|
||||
CMContextConstants.Features.HARDWARE_ABSTRACTION)) {
|
||||
publishBinderService(CMContextConstants.CM_HARDWARE_SERVICE, mService);
|
||||
} else {
|
||||
Log.wtf(TAG, "CM hardware service started by system server but feature xml not" +
|
||||
" declared. Not publishing binder service!");
|
||||
}
|
||||
publishBinderService(CMContextConstants.CM_HARDWARE_SERVICE, mService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFeatureDeclaration() {
|
||||
return CMContextConstants.Features.HARDWARE_ABSTRACTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -58,7 +58,7 @@ import org.cyanogenmod.platform.internal.R;
|
|||
* Internal service which manages interactions with system ui elements
|
||||
* @hide
|
||||
*/
|
||||
public class CMStatusBarManagerService extends SystemService {
|
||||
public class CMStatusBarManagerService extends CMSystemService {
|
||||
private static final String TAG = "CMStatusBarManagerService";
|
||||
|
||||
private Context mContext;
|
||||
|
@ -81,14 +81,13 @@ public class CMStatusBarManagerService extends SystemService {
|
|||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFeatureDeclaration() {
|
||||
return CMContextConstants.Features.STATUSBAR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
if (!mContext.getPackageManager().hasSystemFeature(
|
||||
CMContextConstants.Features.STATUSBAR)) {
|
||||
Log.wtf(TAG, "CM statusbar service started by system server but feature xml not" +
|
||||
" declared. Not publishing binder service!");
|
||||
return;
|
||||
}
|
||||
Log.d(TAG, "registerCMStatusBar cmstatusbar: " + this);
|
||||
mCustomTileListeners = new CustomTileListeners();
|
||||
publishBinderService(CMContextConstants.CM_STATUS_BAR_SERVICE, mService);
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
/**
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.cyanogenmod.platform.internal;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Slog;
|
||||
import com.android.server.LocalServices;
|
||||
import com.android.server.SystemService;
|
||||
import com.android.server.SystemServiceManager;
|
||||
import cyanogenmod.app.CMContextConstants;
|
||||
|
||||
import org.cyanogenmod.platform.internal.display.LiveDisplayService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Base CM System Server which handles the starting and states of various CM
|
||||
* specific system services. Since its part of the main looper provided by the system
|
||||
* server, it will be available indefinitely (until all the things die).
|
||||
*/
|
||||
public class CMSystemServer {
|
||||
private static final String TAG = "CMSystemServer";
|
||||
private Context mSystemContext;
|
||||
private CMSystemServiceHelper mSystemServiceHelper;
|
||||
|
||||
public CMSystemServer(Context systemContext) {
|
||||
mSystemContext = systemContext;
|
||||
mSystemServiceHelper = new CMSystemServiceHelper(mSystemContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked via reflection by the SystemServer
|
||||
*/
|
||||
private void run() {
|
||||
// Start services.
|
||||
try {
|
||||
startServices();
|
||||
} catch (Throwable ex) {
|
||||
Slog.e("System", "******************************************");
|
||||
Slog.e("System", "************ Failure starting cm system services", ex);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
private void startServices() {
|
||||
final Context context = mSystemContext;
|
||||
final SystemServiceManager ssm = LocalServices.getService(SystemServiceManager.class);
|
||||
String[] externalServices = context.getResources().getStringArray(
|
||||
org.cyanogenmod.platform.internal.R.array.config_externalCMServices);
|
||||
|
||||
for (String service : externalServices) {
|
||||
try {
|
||||
Slog.i(TAG, "Attempting to start service " + service);
|
||||
CMSystemService cmSystemService = mSystemServiceHelper.getServiceFor(service);
|
||||
if (context.getPackageManager().hasSystemFeature(
|
||||
cmSystemService.getFeatureDeclaration())) {
|
||||
Slog.i(TAG, "Starting service " + service);
|
||||
ssm.startService(cmSystemService.getClass());
|
||||
} else {
|
||||
Slog.i(TAG, "Not starting service " + service +
|
||||
" due to feature not declared on device");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
reportWtf("starting " + service , e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void reportWtf(String msg, Throwable e) {
|
||||
Slog.w(TAG, "***********************************************");
|
||||
Slog.wtf(TAG, "BOOT FAILURE " + msg, e);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.cyanogenmod.platform.internal;
|
||||
|
||||
import android.content.Context;
|
||||
import com.android.server.SystemService;
|
||||
|
||||
public abstract class CMSystemService extends SystemService {
|
||||
public CMSystemService(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public abstract String getFeatureDeclaration();
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.cyanogenmod.platform.internal;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
/**
|
||||
* Helper methods for fetching a CMSystemService from a class declaration
|
||||
*/
|
||||
public class CMSystemServiceHelper {
|
||||
private Context mContext;
|
||||
|
||||
public CMSystemServiceHelper(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public CMSystemService getServiceFor(String className) {
|
||||
final Class<CMSystemService> serviceClass;
|
||||
try {
|
||||
serviceClass = (Class<CMSystemService>)Class.forName(className);
|
||||
} catch (ClassNotFoundException ex) {
|
||||
throw new RuntimeException("Failed to create service " + className
|
||||
+ ": service class not found", ex);
|
||||
}
|
||||
|
||||
return getServiceFromClass(serviceClass);
|
||||
}
|
||||
|
||||
public <T extends CMSystemService> T getServiceFromClass(Class<T> serviceClass) {
|
||||
final T service;
|
||||
try {
|
||||
Constructor<T> constructor = serviceClass.getConstructor(Context.class);
|
||||
service = constructor.newInstance(mContext);
|
||||
} catch (InstantiationException ex) {
|
||||
throw new RuntimeException("Failed to create service " + serviceClass
|
||||
+ ": service could not be instantiated", ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
throw new RuntimeException("Failed to create service " + serviceClass
|
||||
+ ": service must have a public constructor with a Context argument", ex);
|
||||
} catch (NoSuchMethodException ex) {
|
||||
throw new RuntimeException("Failed to create service " + serviceClass
|
||||
+ ": service must have a public constructor with a Context argument", ex);
|
||||
} catch (InvocationTargetException ex) {
|
||||
throw new RuntimeException("Failed to create service " + serviceClass
|
||||
+ ": service constructor threw an exception", ex);
|
||||
}
|
||||
return service;
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ import cyanogenmod.app.ICMTelephonyManager;
|
|||
*
|
||||
* @hide
|
||||
*/
|
||||
public class CMTelephonyManagerService extends SystemService {
|
||||
public class CMTelephonyManagerService extends CMSystemService {
|
||||
private static final String TAG = "CMTelephonyManagerSrv";
|
||||
private static boolean localLOGD = Log.isLoggable(TAG, Log.DEBUG);
|
||||
|
||||
|
@ -181,18 +181,17 @@ public class CMTelephonyManagerService extends SystemService {
|
|||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFeatureDeclaration() {
|
||||
return CMContextConstants.Features.TELEPHONY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
if (localLOGD) {
|
||||
Log.d(TAG, "CM telephony manager service start: " + this);
|
||||
}
|
||||
if (mContext.getPackageManager().hasSystemFeature(
|
||||
CMContextConstants.Features.TELEPHONY)) {
|
||||
publishBinderService(CMContextConstants.CM_TELEPHONY_MANAGER_SERVICE, mService);
|
||||
} else {
|
||||
Log.wtf(TAG, "CM telephony service started by system server but feature xml not" +
|
||||
" declared. Not publishing binder service!");
|
||||
}
|
||||
publishBinderService(CMContextConstants.CM_TELEPHONY_MANAGER_SERVICE, mService);
|
||||
mTelephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ import cyanogenmod.weatherservice.ServiceRequestResult;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CMWeatherManagerService extends SystemService{
|
||||
public class CMWeatherManagerService extends CMSystemService {
|
||||
|
||||
private static final String TAG = CMWeatherManagerService.class.getSimpleName();
|
||||
|
||||
|
@ -221,6 +221,11 @@ public class CMWeatherManagerService extends SystemService{
|
|||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFeatureDeclaration() {
|
||||
return CMContextConstants.Features.WEATHER_SERVICES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
publishBinderService(CMContextConstants.CM_WEATHER_SERVICE, mService);
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Arrays;
|
|||
import java.util.Comparator;
|
||||
|
||||
/** @hide */
|
||||
public class IconCacheManagerService extends SystemService {
|
||||
public class IconCacheManagerService extends CMSystemService {
|
||||
private static final String TAG = IconCacheManagerService.class.getSimpleName();
|
||||
|
||||
private static final long MAX_ICON_CACHE_SIZE = 33554432L; // 32MB
|
||||
|
@ -49,15 +49,15 @@ public class IconCacheManagerService extends SystemService {
|
|||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFeatureDeclaration() {
|
||||
return CMContextConstants.Features.THEMES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
Log.d(TAG, "registerIconCache cmiconcache: " + this);
|
||||
if (mContext.getPackageManager().hasSystemFeature(CMContextConstants.Features.THEMES)) {
|
||||
publishBinderService(CMContextConstants.CM_ICON_CACHE_SERVICE, mService);
|
||||
} else {
|
||||
Log.wtf(TAG, "IconCache service started by system server but feature xml not" +
|
||||
" declared. Not publishing binder service!");
|
||||
}
|
||||
publishBinderService(CMContextConstants.CM_ICON_CACHE_SERVICE, mService);
|
||||
}
|
||||
|
||||
private void purgeIconCache() {
|
||||
|
|
|
@ -52,7 +52,7 @@ import java.util.List;
|
|||
*
|
||||
* @hide
|
||||
*/
|
||||
public class LiveLockScreenServiceBroker extends SystemService {
|
||||
public class LiveLockScreenServiceBroker extends CMSystemService {
|
||||
private static final String TAG = LiveLockScreenServiceBroker.class.getSimpleName();
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
|
@ -234,17 +234,15 @@ public class LiveLockScreenServiceBroker extends SystemService {
|
|||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFeatureDeclaration() {
|
||||
return CMContextConstants.Features.LIVE_LOCK_SCREEN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
if (DEBUG) Slog.d(TAG, "service started");
|
||||
if (mContext.getPackageManager().hasSystemFeature(
|
||||
CMContextConstants.Features.LIVE_LOCK_SCREEN)) {
|
||||
publishBinderService(CMContextConstants.CM_LIVE_LOCK_SCREEN_SERVICE,
|
||||
new BinderService());
|
||||
} else {
|
||||
Slog.wtf(TAG, "CM live lock screen service started by system server but feature xml " +
|
||||
"not declared. Not publishing binder service!");
|
||||
}
|
||||
publishBinderService(CMContextConstants.CM_LIVE_LOCK_SCREEN_SERVICE, new BinderService());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -48,7 +48,7 @@ import java.security.interfaces.RSAPublicKey;
|
|||
|
||||
/** @hide */
|
||||
|
||||
public class PartnerInterfaceService extends SystemService {
|
||||
public class PartnerInterfaceService extends CMSystemService {
|
||||
|
||||
private static final String TAG = "CMSettingsService";
|
||||
|
||||
|
@ -60,13 +60,12 @@ public class PartnerInterfaceService extends SystemService {
|
|||
public PartnerInterfaceService(Context context) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
if (mContext.getPackageManager().hasSystemFeature(
|
||||
CMContextConstants.Features.PARTNER)) {
|
||||
publishBinderService(CMContextConstants.CM_PARTNER_INTERFACE, mService);
|
||||
} else {
|
||||
Log.wtf(TAG, "CM partner service started by system server but feature xml not" +
|
||||
" declared. Not publishing binder service!");
|
||||
}
|
||||
publishBinderService(CMContextConstants.CM_PARTNER_INTERFACE, mService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFeatureDeclaration() {
|
||||
return CMContextConstants.Features.PARTNER;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,7 +41,7 @@ import cyanogenmod.power.PerformanceManagerInternal;
|
|||
import cyanogenmod.providers.CMSettings;
|
||||
|
||||
/** @hide */
|
||||
public class PerformanceManagerService extends SystemService {
|
||||
public class PerformanceManagerService extends CMSystemService {
|
||||
|
||||
private static final String TAG = "PerformanceManager";
|
||||
|
||||
|
@ -104,15 +104,14 @@ public class PerformanceManagerService extends SystemService {
|
|||
mHandler = new PerformanceManagerHandler(mHandlerThread.getLooper());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFeatureDeclaration() {
|
||||
return CMContextConstants.Features.PERFORMANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
if (mContext.getPackageManager().hasSystemFeature(
|
||||
CMContextConstants.Features.PERFORMANCE)) {
|
||||
publishBinderService(CMContextConstants.CM_PERFORMANCE_SERVICE, mBinder);
|
||||
} else {
|
||||
Log.wtf(TAG, "CM performance service started by system server but feature xml not" +
|
||||
" declared. Not publishing binder service!");
|
||||
}
|
||||
publishBinderService(CMContextConstants.CM_PERFORMANCE_SERVICE, mBinder);
|
||||
publishLocalService(PerformanceManagerInternal.class, new LocalService());
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ import java.util.Map;
|
|||
import java.util.UUID;
|
||||
|
||||
/** @hide */
|
||||
public class ProfileManagerService extends SystemService {
|
||||
public class ProfileManagerService extends CMSystemService {
|
||||
|
||||
private static final String TAG = "CMProfileService";
|
||||
// Enable the below for detailed logging of this class
|
||||
|
@ -178,6 +178,11 @@ public class ProfileManagerService extends SystemService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFeatureDeclaration() {
|
||||
return CMContextConstants.Features.PROFILES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
mBackupManager = new BackupManager(mContext);
|
||||
|
|
|
@ -92,7 +92,7 @@ import static cyanogenmod.platform.Manifest.permission.ACCESS_THEME_MANAGER;
|
|||
import static org.cyanogenmod.internal.util.ThemeUtils.SYSTEM_THEME_PATH;
|
||||
import static org.cyanogenmod.internal.util.ThemeUtils.THEME_BOOTANIMATION_PATH;
|
||||
|
||||
public class ThemeManagerService extends SystemService {
|
||||
public class ThemeManagerService extends CMSystemService {
|
||||
|
||||
private static final String TAG = ThemeManagerService.class.getName();
|
||||
|
||||
|
@ -241,14 +241,14 @@ public class ThemeManagerService extends SystemService {
|
|||
ThemeUtils.createIconCacheDirIfNotExists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFeatureDeclaration() {
|
||||
return CMContextConstants.Features.THEMES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
if (mContext.getPackageManager().hasSystemFeature(CMContextConstants.Features.THEMES)) {
|
||||
publishBinderService(CMContextConstants.CM_THEME_SERVICE, mService);
|
||||
} else {
|
||||
Log.wtf(TAG, "Theme service started by system server but feature xml not" +
|
||||
" declared. Not publishing binder service!");
|
||||
}
|
||||
publishBinderService(CMContextConstants.CM_THEME_SERVICE, mService);
|
||||
// listen for wallpaper changes
|
||||
IntentFilter filter = new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED);
|
||||
mContext.registerReceiver(mWallpaperChangeReceiver, filter);
|
||||
|
|
|
@ -54,6 +54,7 @@ import com.android.server.twilight.TwilightState;
|
|||
|
||||
import org.cyanogenmod.internal.util.QSConstants;
|
||||
import org.cyanogenmod.internal.util.QSUtils;
|
||||
import org.cyanogenmod.platform.internal.CMSystemService;
|
||||
import org.cyanogenmod.platform.internal.R;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
|
@ -79,7 +80,7 @@ import cyanogenmod.providers.CMSettings;
|
|||
* and calibration. It interacts with CMHardwareService to relay
|
||||
* changes down to the lower layers.
|
||||
*/
|
||||
public class LiveDisplayService extends SystemService {
|
||||
public class LiveDisplayService extends CMSystemService {
|
||||
|
||||
private static final String TAG = "LiveDisplay";
|
||||
|
||||
|
@ -146,15 +147,14 @@ public class LiveDisplayService extends SystemService {
|
|||
updateCustomTileEntries();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFeatureDeclaration() {
|
||||
return CMContextConstants.Features.LIVEDISPLAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
if (mContext.getPackageManager().hasSystemFeature(
|
||||
CMContextConstants.Features.LIVEDISPLAY)) {
|
||||
publishBinderService(CMContextConstants.CM_LIVEDISPLAY_SERVICE, mBinder);
|
||||
} else {
|
||||
Log.wtf(TAG, "CM LiveDisplay service started by system server but feature xml not" +
|
||||
" declared. Not publishing binder service!");
|
||||
}
|
||||
publishBinderService(CMContextConstants.CM_LIVEDISPLAY_SERVICE, mBinder);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
<!-- Default wi-fi direct name -->
|
||||
<string name="config_wifiDirectName" translatable="false"></string>
|
||||
|
||||
<!-- Defines external services to be started by the SystemServer at boot. The service itself
|
||||
<!-- Defines external services to be started by the CMSystemServer at boot. The service itself
|
||||
should publish as a binder services in its onStart -->
|
||||
<string-array name="config_externalCMServices">
|
||||
<item>org.cyanogenmod.platform.internal.CMStatusBarManagerService</item>
|
||||
|
@ -106,4 +106,7 @@
|
|||
<item>org.cyanogenmod.platform.internal.display.LiveDisplayService</item>
|
||||
<item>org.cyanogenmod.platform.internal.CMAudioService</item>
|
||||
</string-array>
|
||||
|
||||
<!-- The CMSystemServer class that is invoked from Android's SystemServer -->
|
||||
<string name="config_externalSystemServer" translatable="false">org.cyanogenmod.platform.internal.CMSystemServer</string>
|
||||
</resources>
|
||||
|
|
|
@ -118,4 +118,7 @@
|
|||
<java-symbol type="string" name="qs_themes_label" />
|
||||
<java-symbol type="string" name="qs_themes_content_description" />
|
||||
<java-symbol type="drawable" name="ic_qs_themes" />
|
||||
|
||||
<!-- CM system server -->
|
||||
<java-symbol type="string" name="config_externalSystemServer" />
|
||||
</resources>
|
||||
|
|
|
@ -68,7 +68,7 @@ public class CMStatusBarManager {
|
|||
|
||||
if (context.getPackageManager().hasSystemFeature(
|
||||
cyanogenmod.app.CMContextConstants.Features.STATUSBAR) && sService == null) {
|
||||
throw new RuntimeException("Unable to get CMStatusBarService. The service either" +
|
||||
Log.wtf(TAG, "Unable to get CMStatusBarService. The service either" +
|
||||
" crashed, was not started, or the interface has been called to early in" +
|
||||
" SystemServer init");
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class CMTelephonyManager {
|
|||
|
||||
if (context.getPackageManager().hasSystemFeature(CMContextConstants.Features.TELEPHONY)
|
||||
&& sService == null) {
|
||||
throw new RuntimeException("Unable to get CMTelephonyManagerService. " +
|
||||
Log.wtf(TAG, "Unable to get CMTelephonyManagerService. " +
|
||||
"The service either crashed, was not started, or the interface has been " +
|
||||
"called to early in SystemServer init");
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class LiveLockScreenManager {
|
|||
sService = getService();
|
||||
if (context.getPackageManager().hasSystemFeature(
|
||||
CMContextConstants.Features.LIVE_LOCK_SCREEN) && sService == null) {
|
||||
throw new RuntimeException("Unable to get LiveLockScreenManagerService. " +
|
||||
Log.wtf(TAG, "Unable to get LiveLockScreenManagerService. " +
|
||||
"The service either crashed, was not started, or the interface has " +
|
||||
"been called to early in SystemServer init");
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ public class ProfileManager {
|
|||
|
||||
if (context.getPackageManager().hasSystemFeature(
|
||||
cyanogenmod.app.CMContextConstants.Features.PROFILES) && sService == null) {
|
||||
throw new RuntimeException("Unable to get ProfileManagerService. The service either" +
|
||||
Log.wtf(TAG, "Unable to get ProfileManagerService. The service either" +
|
||||
" crashed, was not started, or the interface has been called to early in" +
|
||||
" SystemServer init");
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ public final class CMHardwareManager {
|
|||
|
||||
if (context.getPackageManager().hasSystemFeature(
|
||||
CMContextConstants.Features.HARDWARE_ABSTRACTION) && !checkService()) {
|
||||
throw new RuntimeException("Unable to get CMHardwareService. The service either" +
|
||||
Log.wtf(TAG, "Unable to get CMHardwareService. The service either" +
|
||||
" crashed, was not started, or the interface has been called to early in" +
|
||||
" SystemServer init");
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ public class LiveDisplayManager {
|
|||
|
||||
if (!context.getPackageManager().hasSystemFeature(
|
||||
CMContextConstants.Features.LIVEDISPLAY) || !checkService()) {
|
||||
throw new RuntimeException("Unable to get LiveDisplayService. The service either" +
|
||||
Log.wtf(TAG, "Unable to get LiveDisplayService. The service either" +
|
||||
" crashed, was not started, or the interface has been called to early in" +
|
||||
" SystemServer init");
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public final class CMAudioManager {
|
|||
|
||||
if (!context.getPackageManager().hasSystemFeature(
|
||||
CMContextConstants.Features.AUDIO) || !checkService()) {
|
||||
throw new RuntimeException("Unable to get CMAudioService. The service either" +
|
||||
Log.wtf(TAG, "Unable to get CMAudioService. The service either" +
|
||||
" crashed, was not started, or the interface has been called to early in" +
|
||||
" SystemServer init");
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public class PerformanceManager {
|
|||
sService = getService();
|
||||
if (context.getPackageManager().hasSystemFeature(
|
||||
CMContextConstants.Features.PERFORMANCE) && sService == null) {
|
||||
throw new RuntimeException("Unable to get PerformanceManagerService. The service" +
|
||||
Log.wtf(TAG, "Unable to get PerformanceManagerService. The service" +
|
||||
" either crashed, was not started, or the interface has been called to early" +
|
||||
" in SystemServer init");
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class ThemeManager {
|
|||
sService = getService();
|
||||
if (context.getPackageManager().hasSystemFeature(
|
||||
CMContextConstants.Features.THEMES) && sService == null) {
|
||||
throw new RuntimeException("Unable to get ThemeManagerService. The service either" +
|
||||
Log.wtf(TAG, "Unable to get ThemeManagerService. The service either" +
|
||||
" crashed, was not started, or the interface has been called to early in" +
|
||||
" SystemServer init");
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.os.IBinder;
|
|||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Log;
|
||||
import cyanogenmod.app.CMContextConstants;
|
||||
import cyanogenmod.providers.CMSettings;
|
||||
import cyanogenmod.providers.WeatherContract;
|
||||
|
@ -90,7 +91,7 @@ public class CMWeatherManager {
|
|||
|
||||
if (context.getPackageManager().hasSystemFeature(
|
||||
CMContextConstants.Features.WEATHER_SERVICES) && (sWeatherManagerService == null)) {
|
||||
throw new RuntimeException("Unable to bind the CMWeatherManagerService");
|
||||
Log.wtf(TAG, "Unable to bind the CMWeatherManagerService");
|
||||
}
|
||||
mHandler = new Handler(appContext.getMainLooper());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue