Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec932350 authored by Eric Laurent's avatar Eric Laurent Committed by Android Git Automerger
Browse files

am 776339fe: am c8ade15d: Merge "Silent and Vibrate mode clean up" into jb-dev

* commit '776339fe':
  Silent and Vibrate mode clean up
parents e92c4e02 776339fe
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1557,6 +1557,9 @@ public final class Settings {
         * will likely be removed in a future release with support for
         * audio/vibe feedback profiles.
         *
         * Not used anymore. On devices with vibrator, the user explicitly selects
         * silent or vibrate mode.
         * Kept for use by legacy database upgrade code in DatabaseHelper.
         * @hide
         */
        public static final String VIBRATE_IN_SILENT = "vibrate_in_silent";
@@ -1983,7 +1986,6 @@ public final class Settings {
            SCREEN_BRIGHTNESS,
            SCREEN_BRIGHTNESS_MODE,
            SCREEN_AUTO_BRIGHTNESS_ADJ,
            VIBRATE_ON,
            VIBRATE_INPUT_DEVICES,
            MODE_RINGER,
            MODE_RINGER_STREAMS_AFFECTED,
@@ -2002,7 +2004,6 @@ public final class Settings {
            VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE,
            VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE,
            VOLUME_BLUETOOTH_SCO + APPEND_FOR_LAST_AUDIBLE,
            VIBRATE_IN_SILENT,
            TEXT_AUTO_REPLACE,
            TEXT_AUTO_CAPS,
            TEXT_AUTO_PUNCTUATE,
+152 −84
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.Vibrator;
import android.provider.Settings;
import android.provider.Settings.System;
import android.telephony.PhoneStateListener;
@@ -119,19 +120,18 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
    private static final int MSG_PERSIST_VOLUME = 1;
    private static final int MSG_PERSIST_MASTER_VOLUME = 2;
    private static final int MSG_PERSIST_RINGER_MODE = 3;
    private static final int MSG_PERSIST_VIBRATE_SETTING = 4;
    private static final int MSG_MEDIA_SERVER_DIED = 5;
    private static final int MSG_MEDIA_SERVER_STARTED = 6;
    private static final int MSG_PLAY_SOUND_EFFECT = 7;
    private static final int MSG_BTA2DP_DOCK_TIMEOUT = 8;
    private static final int MSG_LOAD_SOUND_EFFECTS = 9;
    private static final int MSG_SET_FORCE_USE = 10;
    private static final int MSG_PERSIST_MEDIABUTTONRECEIVER = 11;
    private static final int MSG_BT_HEADSET_CNCT_FAILED = 12;
    private static final int MSG_RCDISPLAY_CLEAR = 13;
    private static final int MSG_RCDISPLAY_UPDATE = 14;
    private static final int MSG_SET_ALL_VOLUMES = 15;
    private static final int MSG_PERSIST_MASTER_VOLUME_MUTE = 16;
    private static final int MSG_MEDIA_SERVER_DIED = 4;
    private static final int MSG_MEDIA_SERVER_STARTED = 5;
    private static final int MSG_PLAY_SOUND_EFFECT = 6;
    private static final int MSG_BTA2DP_DOCK_TIMEOUT = 7;
    private static final int MSG_LOAD_SOUND_EFFECTS = 8;
    private static final int MSG_SET_FORCE_USE = 9;
    private static final int MSG_PERSIST_MEDIABUTTONRECEIVER = 10;
    private static final int MSG_BT_HEADSET_CNCT_FAILED = 11;
    private static final int MSG_RCDISPLAY_CLEAR = 12;
    private static final int MSG_RCDISPLAY_UPDATE = 13;
    private static final int MSG_SET_ALL_VOLUMES = 14;
    private static final int MSG_PERSIST_MASTER_VOLUME_MUTE = 15;


    // flags for MSG_PERSIST_VOLUME indicating if current and/or last audible volume should be
@@ -241,6 +241,20 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
    };
    private int[] mStreamVolumeAlias;

    // stream names used by dumpStreamStates()
    private final String[] STREAM_NAMES = new String[] {
            "STREAM_VOICE_CALL",
            "STREAM_SYSTEM",
            "STREAM_RING",
            "STREAM_MUSIC",
            "STREAM_ALARM",
            "STREAM_NOTIFICATION",
            "STREAM_BLUETOOTH_SCO",
            "STREAM_SYSTEM_ENFORCED",
            "STREAM_DTMF",
            "STREAM_TTS"
    };

    private final AudioSystem.ErrorCallback mAudioSystemCallback = new AudioSystem.ErrorCallback() {
        public void onError(int error) {
            switch (error) {
@@ -282,14 +296,15 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
    private int mMuteAffectedStreams;

    /**
     * Has multiple bits per vibrate type to indicate the type's vibrate
     * setting. See {@link #setVibrateSetting(int, int)}.
     * <p>
     * NOTE: This is not the final decision of whether vibrate is on/off for the
     * type since it depends on the ringer mode. See {@link #shouldVibrate(int)}.
     * NOTE: setVibrateSetting(), getVibrateSetting(), shouldVibrate() are deprecated.
     * mVibrateSetting is just maintained during deprecation period but vibration policy is
     * now only controlled by mHasVibrator and mRingerMode
     */
    private int mVibrateSetting;

    // Is there a vibrator
    private final boolean mHasVibrator;

    // Broadcast receiver for device connections intent broadcasts
    private final BroadcastReceiver mReceiver = new AudioServiceBroadcastReceiver();

@@ -388,6 +403,9 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
        PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
        mMediaEventWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "mediaKeyEvent");

        Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
        mHasVibrator = vibrator == null ? false : vibrator.hasVibrator();

       // Intialized volume
        MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = SystemProperties.getInt(
            "ro.config.vc_call_vol_steps",
@@ -507,6 +525,16 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
        }
    }

    private void dumpStreamStates(PrintWriter pw) {
        pw.println("\nStream volumes (device: index)");
        int numStreamTypes = AudioSystem.getNumStreamTypes();
        for (int i = 0; i < numStreamTypes; i++) {
            pw.println("- "+STREAM_NAMES[i]+":");
            mStreamStates[i].dump(pw);
            pw.println("");
        }
    }


    private void updateStreamVolumeAlias(boolean updateVolumes) {
        int dtmfStreamAlias;
@@ -538,18 +566,34 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
    private void readPersistedSettings() {
        final ContentResolver cr = mContentResolver;

        int ringerMode = System.getInt(cr, System.MODE_RINGER, AudioManager.RINGER_MODE_NORMAL);
        int ringerModeFromSettings =
                System.getInt(cr, System.MODE_RINGER, AudioManager.RINGER_MODE_NORMAL);
        int ringerMode = ringerModeFromSettings;
        // sanity check in case the settings are restored from a device with incompatible
        // ringer modes
        if (!AudioManager.isValidRingerMode(ringerMode)) {
            ringerMode = AudioManager.RINGER_MODE_NORMAL;
        }
        if ((ringerMode == AudioManager.RINGER_MODE_VIBRATE) && !mHasVibrator) {
            ringerMode = AudioManager.RINGER_MODE_SILENT;
        }
        if (ringerMode != ringerModeFromSettings) {
            System.putInt(cr, System.MODE_RINGER, ringerMode);
        }
        synchronized(mSettingsLock) {
            mRingerMode = ringerMode;
        }

        mVibrateSetting = System.getInt(cr, System.VIBRATE_ON, 0);
        // System.VIBRATE_ON is not used any more but defaults for mVibrateSetting
        // are still needed while setVibrateSetting() and getVibrateSetting() are being deprecated.
        mVibrateSetting = getValueForVibrateSetting(0,
                                        AudioManager.VIBRATE_TYPE_NOTIFICATION,
                                        mHasVibrator ? AudioManager.VIBRATE_SETTING_ONLY_SILENT
                                                        : AudioManager.VIBRATE_SETTING_OFF);
        mVibrateSetting = getValueForVibrateSetting(mVibrateSetting,
                                        AudioManager.VIBRATE_TYPE_RINGER,
                                        mHasVibrator ? AudioManager.VIBRATE_SETTING_ONLY_SILENT
                                                        : AudioManager.VIBRATE_SETTING_OFF);

        // make sure settings for ringer mode are consistent with device type: non voice capable
        // devices (tablets) include media stream in silent mode whereas phones don't.
@@ -639,8 +683,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
        // If either the client forces allowing ringer modes for this adjustment,
        // or the stream type is one that is affected by ringer modes
        if (((flags & AudioManager.FLAG_ALLOW_RINGER_MODES) != 0) ||
                streamTypeAlias == AudioSystem.STREAM_RING ||
                (!mVoiceCapable && streamTypeAlias == AudioSystem.STREAM_MUSIC)) {
                (streamTypeAlias == getMasterStreamType())) {
            int ringerMode = getRingerMode();
            // do not vibrate if already in vibrate mode
            if (ringerMode == AudioManager.RINGER_MODE_VIBRATE) {
@@ -648,7 +691,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
            }
            // Check if the ringer mode changes with this volume adjustment. If
            // it does, it will handle adjusting the volume, so we won't below
            adjustVolume = checkForRingerModeChange(oldIndex, direction, streamTypeAlias);
            adjustVolume = checkForRingerModeChange(oldIndex, direction);
        }

        // If stream is muted, adjust last audible index only
@@ -724,8 +767,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
                (mStreamVolumeAlias[streamType] == getMasterStreamType())) {
            int newRingerMode;
            if (index == 0) {
                newRingerMode = System.getInt(mContentResolver, System.VIBRATE_IN_SILENT, 1) == 1
                    ? AudioManager.RINGER_MODE_VIBRATE
                newRingerMode = mHasVibrator ? AudioManager.RINGER_MODE_VIBRATE
                                              : AudioManager.RINGER_MODE_SILENT;
                setStreamVolumeInt(mStreamVolumeAlias[streamType],
                                   index,
@@ -1070,7 +1112,6 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
                    // on voice capable devices
                    if (mVoiceCapable &&
                            mStreamVolumeAlias[streamType] == AudioSystem.STREAM_RING) {

                        Set set = mStreamStates[streamType].mLastAudibleIndex.entrySet();
                        Iterator i = set.iterator();
                        while (i.hasNext()) {
@@ -1111,6 +1152,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished {

    /** @see AudioManager#shouldVibrate(int) */
    public boolean shouldVibrate(int vibrateType) {
        if (!mHasVibrator) return false;

        switch (getVibrateSetting(vibrateType)) {

@@ -1131,21 +1173,20 @@ public class AudioService extends IAudioService.Stub implements OnFinished {

    /** @see AudioManager#getVibrateSetting(int) */
    public int getVibrateSetting(int vibrateType) {
        if (!mHasVibrator) return AudioManager.VIBRATE_SETTING_OFF;
        return (mVibrateSetting >> (vibrateType * 2)) & 3;
    }

    /** @see AudioManager#setVibrateSetting(int, int) */
    public void setVibrateSetting(int vibrateType, int vibrateSetting) {

        if (!mHasVibrator) return;

        mVibrateSetting = getValueForVibrateSetting(mVibrateSetting, vibrateType, vibrateSetting);

        // Broadcast change
        broadcastVibrateSetting(vibrateType);

        // Post message to set ringer mode (it in turn will post a message
        // to persist)
        sendMsg(mAudioHandler, MSG_PERSIST_VIBRATE_SETTING, SENDMSG_NOOP, 0, 0,
                null, 0);
    }

    /**
@@ -1967,48 +2008,56 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
     * adjusting volume. If so, this will set the proper ringer mode and volume
     * indices on the stream states.
     */
    private boolean checkForRingerModeChange(int oldIndex, int direction, int streamType) {
    private boolean checkForRingerModeChange(int oldIndex, int direction) {
        boolean adjustVolumeIndex = true;
        int ringerMode = getRingerMode();
        int newRingerMode = ringerMode;
        int uiIndex = (oldIndex + 5) / 10;
        boolean vibeInSilent = System.getInt(mContentResolver, System.VIBRATE_IN_SILENT, 1) == 1;

        if (ringerMode == RINGER_MODE_NORMAL) {
            if ((direction == AudioManager.ADJUST_LOWER) && (uiIndex <= 1)) {
                // enter silent mode if current index is the last audible one and not repeating a
                // volume key down
                if (vibeInSilent || mPrevVolDirection != AudioManager.ADJUST_LOWER) {
                    // "silent mode", but which one?
                    newRingerMode = vibeInSilent ? RINGER_MODE_VIBRATE : RINGER_MODE_SILENT;
                }
                if (uiIndex == 0 ||
                        (!vibeInSilent &&
                         mPrevVolDirection == AudioManager.ADJUST_LOWER &&
                         mVoiceCapable && streamType == AudioSystem.STREAM_RING)) {
                    adjustVolumeIndex = false;

        switch (ringerMode) {
        case RINGER_MODE_NORMAL:
            if (direction == AudioManager.ADJUST_LOWER) {
                if (mHasVibrator) {
                    if (uiIndex == 1) {
                        ringerMode = RINGER_MODE_VIBRATE;
                    }
                } else {
                    if (uiIndex == 0 && mPrevVolDirection != AudioManager.ADJUST_LOWER) {
                        ringerMode = RINGER_MODE_SILENT;
                    }
                }
        } else if (ringerMode == RINGER_MODE_VIBRATE) {
            }
            break;
        case RINGER_MODE_VIBRATE:
            if (!mHasVibrator) {
                Log.e(TAG, "checkForRingerModeChange() current ringer mode is vibrate" +
                        "but no vibrator is present");
                break;
            }
            if ((direction == AudioManager.ADJUST_LOWER)) {
                // Set it to silent, if it wasn't a long-press
                if (mPrevVolDirection != AudioManager.ADJUST_LOWER) {
                    newRingerMode = RINGER_MODE_SILENT;
                    ringerMode = RINGER_MODE_SILENT;
                }
            } else if (direction == AudioManager.ADJUST_RAISE) {
                newRingerMode = RINGER_MODE_NORMAL;
                ringerMode = RINGER_MODE_NORMAL;
            }
            adjustVolumeIndex = false;
        } else {
            break;
        case RINGER_MODE_SILENT:
            if (direction == AudioManager.ADJUST_RAISE) {
                // exiting silent mode
                // If VIBRATE_IN_SILENT, then go into vibrate mode
                newRingerMode = vibeInSilent ? RINGER_MODE_VIBRATE : RINGER_MODE_NORMAL;
                if (mHasVibrator) {
                    ringerMode = RINGER_MODE_VIBRATE;
                } else {
                    ringerMode = RINGER_MODE_NORMAL;
                }
            }
            adjustVolumeIndex = false;
            break;
        default:
            Log.e(TAG, "checkForRingerModeChange() wrong ringer mode: "+ringerMode);
            break;
        }

        setRingerMode(newRingerMode);
        setRingerMode(ringerMode);

        mPrevVolDirection = direction;

@@ -2217,9 +2266,6 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
        }

        public void readSettings() {
            boolean checkSilentVolume = (mRingerMode == AudioManager.RINGER_MODE_NORMAL) &&
                                            isStreamAffectedByRingerMode(mStreamType);

            int remainingDevices = AudioSystem.DEVICE_OUT_ALL;

            for (int i = 0; remainingDevices != 0; i++) {
@@ -2248,12 +2294,13 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
                                    index : AudioManager.DEFAULT_STREAM_VOLUME[mStreamType];
                int lastAudibleIndex = Settings.System.getInt(mContentResolver, name, defaultIndex);

                // a last audible index of 0 is never stored, except on non-voice capable devices
                // (e.g. tablets) for the music stream type, where the music stream volume can reach
                // 0 without the device being in silent mode
                // a last audible index of 0 should never be stored for ring and notification
                // streams on phones (voice capable devices).
                // same for system stream on phones and tablets
                if ((lastAudibleIndex == 0) &&
                        (mVoiceCapable ||
                         (mStreamVolumeAlias[mStreamType] != AudioSystem.STREAM_MUSIC))) {
                        ((mVoiceCapable &&
                                (mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_RING)) ||
                         (mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_SYSTEM))) {
                    lastAudibleIndex = AudioManager.DEFAULT_STREAM_VOLUME[mStreamType];
                    // Correct the data base
                    sendMsg(mAudioHandler,
@@ -2265,12 +2312,13 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
                            PERSIST_DELAY);
                }
                mLastAudibleIndex.put(device, getValidIndex(10 * lastAudibleIndex));
                // the initial index should never be 0 for a stream affected by ringer mode if not
                // in silent or vibrate mode.
                // this is permitted on tablets for music stream type.
                if (checkSilentVolume && (index == 0) &&
                        (mVoiceCapable ||
                         (mStreamVolumeAlias[mStreamType] != AudioSystem.STREAM_MUSIC))) {
                // the initial index should never be 0 for ring and notification streams on phones
                // (voice capable devices) if not in silent or vibrate mode.
                // same for system stream on phones and tablets
                if ((index == 0) && (mRingerMode == AudioManager.RINGER_MODE_NORMAL) &&
                        ((mVoiceCapable &&
                                (mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_RING)) ||
                         (mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_SYSTEM))) {
                    index = lastAudibleIndex;
                    // Correct the data base
                    sendMsg(mAudioHandler,
@@ -2328,16 +2376,24 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
                    mLastAudibleIndex.put(device, index);
                }
                // Apply change to all streams using this one as alias
                // if changing volume of current device, also change volume of current
                // device on aliased stream
                boolean currentDevice = (device == getDeviceForStream(mStreamType));
                int numStreamTypes = AudioSystem.getNumStreamTypes();
                for (int streamType = numStreamTypes - 1; streamType >= 0; streamType--) {
                    if (streamType != mStreamType && mStreamVolumeAlias[streamType] == mStreamType) {
                        mStreamStates[streamType].setIndex(rescaleIndex(index,
                                                                        mStreamType,
                                                                        streamType),
                    if (streamType != mStreamType &&
                            mStreamVolumeAlias[streamType] == mStreamType) {
                        int scaledIndex = rescaleIndex(index, mStreamType, streamType);
                        mStreamStates[streamType].setIndex(scaledIndex,
                                                           device,
                                                           lastAudible);
                        if (currentDevice) {
                            mStreamStates[streamType].setIndex(scaledIndex,
                                                               getDeviceForStream(streamType),
                                                               lastAudible);
                        }
                    }
                }
                return true;
            } else {
                return false;
@@ -2544,6 +2600,25 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
                return handler;
            }
        }

        private void dump(PrintWriter pw) {
            pw.print("   Current: ");
            Set set = mIndex.entrySet();
            Iterator i = set.iterator();
            while (i.hasNext()) {
                Map.Entry entry = (Map.Entry)i.next();
                pw.print(Integer.toHexString(((Integer)entry.getKey()).intValue())
                             + ": " + ((((Integer)entry.getValue()).intValue() + 5) / 10)+", ");
            }
            pw.print("\n   Last audible: ");
            set = mLastAudibleIndex.entrySet();
            i = set.iterator();
            while (i.hasNext()) {
                Map.Entry entry = (Map.Entry)i.next();
                pw.print(Integer.toHexString(((Integer)entry.getKey()).intValue())
                             + ": " + ((((Integer)entry.getValue()).intValue() + 5) / 10)+", ");
            }
        }
    }

    /** Thread that handles native AudioSystem control. */
@@ -2631,10 +2706,6 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
            System.putInt(mContentResolver, System.MODE_RINGER, ringerMode);
        }

        private void persistVibrateSetting() {
            System.putInt(mContentResolver, System.VIBRATE_ON, mVibrateSetting);
        }

        private void playSoundEffect(int effectType, int volume) {
            synchronized (mSoundEffectsLock) {
                if (mSoundPool == null) {
@@ -2734,10 +2805,6 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
                    persistRingerMode(getRingerMode());
                    break;

                case MSG_PERSIST_VIBRATE_SETTING:
                    persistVibrateSetting();
                    break;

                case MSG_MEDIA_SERVER_DIED:
                    if (!mMediaServerOk) {
                        Log.e(TAG, "Media server died.");
@@ -4366,5 +4433,6 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
        // TODO probably a lot more to do here than just the audio focus and remote control stacks
        dumpFocusStack(pw);
        dumpRCStack(pw);
        dumpStreamStates(pw);
    }
}
+6 −0
Original line number Diff line number Diff line
@@ -260,6 +260,8 @@ public class AudioSystem
    public static final String DEVICE_OUT_AUX_DIGITAL_NAME = "aux_digital";
    public static final String DEVICE_OUT_ANLG_DOCK_HEADSET_NAME = "analog_dock";
    public static final String DEVICE_OUT_DGTL_DOCK_HEADSET_NAME = "digital_dock";
    public static final String DEVICE_OUT_USB_ACCESSORY_NAME = "usb_accessory";
    public static final String DEVICE_OUT_USB_DEVICE_NAME = "usb_device";

    public static String getDeviceName(int device)
    {
@@ -290,6 +292,10 @@ public class AudioSystem
            return DEVICE_OUT_ANLG_DOCK_HEADSET_NAME;
        case DEVICE_OUT_DGTL_DOCK_HEADSET:
            return DEVICE_OUT_DGTL_DOCK_HEADSET_NAME;
        case DEVICE_OUT_USB_ACCESSORY:
            return DEVICE_OUT_USB_ACCESSORY_NAME;
        case DEVICE_OUT_USB_DEVICE:
            return DEVICE_OUT_USB_DEVICE_NAME;
        case DEVICE_IN_DEFAULT:
        default:
            return "";
+18 −6
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
    // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
    // is properly propagated through your change.  Not doing so will result in a loss of user
    // settings.
    private static final int DATABASE_VERSION = 76;
    private static final int DATABASE_VERSION = 77;

    private Context mContext;

@@ -1031,6 +1031,23 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            upgradeVersion = 76;
        }

        /************* The following are Jelly Bean changes ************/

        if (upgradeVersion == 76) {
            // Removed VIBRATE_IN_SILENT setting
            db.beginTransaction();
            try {
                db.execSQL("DELETE FROM system WHERE name='"
                                + Settings.System.VIBRATE_IN_SILENT + "'");
                db.setTransactionSuccessful();
            } finally {
                db.endTransaction();
            }

            upgradeVersion = 77;
        }


        // *** Remember to update DATABASE_VERSION above!

        if (upgradeVersion != currentVersion) {
@@ -1311,8 +1328,6 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            loadSetting(stmt, Settings.System.MODE_RINGER,
                    AudioManager.RINGER_MODE_NORMAL);
    
            loadVibrateSetting(db, false);
    
            // By default:
            // - ringtones, notification, system and music streams are affected by ringer mode
            // on non voice capable devices (tablets)
@@ -1433,9 +1448,6 @@ public class DatabaseHelper extends SQLiteOpenHelper {

            loadUISoundEffectsSettings(stmt);

            loadBooleanSetting(stmt, Settings.System.VIBRATE_IN_SILENT,
                    R.bool.def_vibrate_in_silent);

            loadIntegerSetting(stmt, Settings.System.POINTER_SPEED,
                    R.integer.def_pointer_speed);

+0 −15
Original line number Diff line number Diff line
@@ -43,9 +43,6 @@ public class SettingsHelper {
    private IContentService mContentService;
    private IPowerManager mPowerManager;

    private boolean mSilent;
    private boolean mVibrate;

    public SettingsHelper(Context context) {
        mContext = context;
        mAudioManager = (AudioManager) context
@@ -119,18 +116,6 @@ public class SettingsHelper {
        }
    }

    private void setRingerMode() {
        if (mSilent) {
            mAudioManager.setRingerMode(mVibrate ? AudioManager.RINGER_MODE_VIBRATE :
                AudioManager.RINGER_MODE_SILENT);
        } else {
            mAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
            mAudioManager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,
                    mVibrate ? AudioManager.VIBRATE_SETTING_ON
                            : AudioManager.VIBRATE_SETTING_OFF);
        }
    }

    byte[] getLocaleData() {
        Configuration conf = mContext.getResources().getConfiguration();
        final Locale loc = conf.locale;
Loading