use of cyanogenmod.hardware.CMHardwareManager in project android_frameworks_base by ResurrectionRemix.
the class VibratorService method systemReady.
public void systemReady() {
mIm = mContext.getSystemService(InputManager.class);
mSettingObserver = new SettingsObserver(mH);
mPowerManagerInternal = LocalServices.getService(PowerManagerInternal.class);
mPowerManagerInternal.registerLowPowerModeObserver(new PowerManagerInternal.LowPowerModeListener() {
@Override
public void onLowPowerModeChanged(boolean enabled) {
updateInputDeviceVibrators();
}
});
final CMHardwareManager hardware = CMHardwareManager.getInstance(mContext);
if (hardware.isSupported(CMHardwareManager.FEATURE_VIBRATOR)) {
mContext.getContentResolver().registerContentObserver(CMSettings.Secure.getUriFor(CMSettings.Secure.VIBRATOR_INTENSITY), true, mSettingObserver, UserHandle.USER_ALL);
updateVibratorIntensity();
}
mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(Settings.System.VIBRATE_INPUT_DEVICES), true, mSettingObserver, UserHandle.USER_ALL);
mContext.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
updateInputDeviceVibrators();
updateVibratorIntensity();
}
}, new IntentFilter(Intent.ACTION_USER_SWITCHED), null, mH);
updateInputDeviceVibrators();
}
use of cyanogenmod.hardware.CMHardwareManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class OtherSoundSettings method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.other_sound_settings);
mContext = getActivity();
mAnnoyingNotifications = (ListPreference) findPreference(PREF_LESS_NOTIFICATION_SOUNDS);
int notificationThreshold = System.getInt(getContentResolver(), System.MUTE_ANNOYING_NOTIFICATIONS_THRESHOLD, 0);
mAnnoyingNotifications.setValue(Integer.toString(notificationThreshold));
mAnnoyingNotifications.setOnPreferenceChangeListener(this);
mCameraSounds = (SwitchPreference) findPreference(KEY_CAMERA_SOUNDS);
mCameraSounds.setChecked(SystemProperties.getBoolean(PROP_CAMERA_SOUND, true));
mCameraSounds.setOnPreferenceChangeListener(this);
for (SettingPref pref : PREFS) {
pref.init(this);
}
if (mContext.getResources().getBoolean(R.bool.has_boot_sounds)) {
mBootSounds = (SwitchPreference) findPreference(KEY_BOOT_SOUNDS);
mBootSounds.setChecked(SystemProperties.getBoolean(PROPERTY_BOOT_SOUNDS, true));
} else {
removePreference(KEY_BOOT_SOUNDS);
}
final CMHardwareManager hardware = CMHardwareManager.getInstance(mContext);
if (!hardware.isSupported(CMHardwareManager.FEATURE_VIBRATOR)) {
removePreference(CMSettings.Secure.VIBRATOR_INTENSITY);
}
}
Aggregations