Search in sources :

Example 6 with CMHardwareManager

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();
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) PowerManagerInternal(android.os.PowerManagerInternal) Intent(android.content.Intent) InputManager(android.hardware.input.InputManager) BroadcastReceiver(android.content.BroadcastReceiver) CMHardwareManager(cyanogenmod.hardware.CMHardwareManager)

Example 7 with CMHardwareManager

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);
    }
}
Also used : CMHardwareManager(cyanogenmod.hardware.CMHardwareManager)

Aggregations

CMHardwareManager (cyanogenmod.hardware.CMHardwareManager)7 BroadcastReceiver (android.content.BroadcastReceiver)2 Context (android.content.Context)2 Intent (android.content.Intent)2 IntentFilter (android.content.IntentFilter)2 InputManager (android.hardware.input.InputManager)2 PowerManagerInternal (android.os.PowerManagerInternal)2 LightingColorFilter (android.graphics.LightingColorFilter)1 Drawable (android.graphics.drawable.Drawable)1 LayerDrawable (android.graphics.drawable.LayerDrawable)1