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

Commit 6a1770f4 authored by Koushik Dutta's avatar Koushik Dutta
Browse files

Merge branch 'gingerbread' of git://github.com/CyanogenMod/android_frameworks_base into gingerbread

parents 5b18b58e 5eeec666
Loading
Loading
Loading
Loading
+12 −1
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ import android.content.IntentFilter;
import android.os.Message;
import android.os.Message;
import android.os.PowerManager;
import android.os.PowerManager;
import android.os.SystemClock;
import android.os.SystemClock;
import android.provider.Settings;
import android.server.BluetoothA2dpService;
import android.server.BluetoothA2dpService;
import android.server.BluetoothService;
import android.server.BluetoothService;
import android.util.Log;
import android.util.Log;
@@ -83,6 +84,7 @@ public final class BluetoothDeviceProfileState extends HierarchicalStateMachine


    private static final int AUTO_CONNECT_DELAY = 6000; // 6 secs
    private static final int AUTO_CONNECT_DELAY = 6000; // 6 secs
    private static final int CONNECT_OTHER_PROFILES_DELAY = 4000; // 4 secs
    private static final int CONNECT_OTHER_PROFILES_DELAY = 4000; // 4 secs
    private static final int CONNECT_OTHER_PROFILES_DELAY_FAST = 100; // 100ms
    private static final int CONNECTION_ACCESS_REQUEST_EXPIRY_TIMEOUT = 7000; // 7 secs
    private static final int CONNECTION_ACCESS_REQUEST_EXPIRY_TIMEOUT = 7000; // 7 secs
    private static final int CONNECTION_ACCESS_UNDEFINED = -1;
    private static final int CONNECTION_ACCESS_UNDEFINED = -1;
    private static final long INIT_INCOMING_REJECT_TIMER = 1000; // 1 sec
    private static final long INIT_INCOMING_REJECT_TIMER = 1000; // 1 sec
@@ -824,7 +826,16 @@ public final class BluetoothDeviceProfileState extends HierarchicalStateMachine
        i.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
        i.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
        i.putExtra(ACTION_CONNECT_TYPE, type);
        i.putExtra(ACTION_CONNECT_TYPE, type);
        PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, i, 0);
        PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, i, 0);
        mgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + CONNECT_OTHER_PROFILES_DELAY, pi);

        long delayTime = CONNECT_OTHER_PROFILES_DELAY;

        // Many devices don't need the long delay.
        if (Settings.System.getInt(mContext.getContentResolver(),
                    Settings.System.BLUETOOTH_FAST_CONNECT, 0) != 0) {
            delayTime = CONNECT_OTHER_PROFILES_DELAY_FAST;
        }

        mgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + delayTime, pi);
    }
    }


    private int getTrust() {
    private int getTrust() {
+13 −1
Original line number Original line Diff line number Diff line
@@ -51,10 +51,14 @@ public final class BluetoothUuid {
            ParcelUuid.fromString("00001105-0000-1000-8000-00805f9b34fb");
            ParcelUuid.fromString("00001105-0000-1000-8000-00805f9b34fb");
    public static final ParcelUuid HID =
    public static final ParcelUuid HID =
            ParcelUuid.fromString("00001124-0000-1000-8000-00805f9b34fb");
            ParcelUuid.fromString("00001124-0000-1000-8000-00805f9b34fb");
    public static final ParcelUuid MessageAccessServer =
            ParcelUuid.fromString("00001132-0000-1000-8000-00805f9b34fb");
    public static final ParcelUuid MessageNotificationServer =
            ParcelUuid.fromString("00001133-0000-1000-8000-00805f9b34fb");


    public static final ParcelUuid[] RESERVED_UUIDS = {
    public static final ParcelUuid[] RESERVED_UUIDS = {
        AudioSink, AudioSource, AdvAudioDist, HSP, Handsfree, AvrcpController, AvrcpTarget,
        AudioSink, AudioSource, AdvAudioDist, HSP, Handsfree, AvrcpController, AvrcpTarget,
        ObexObjectPush,HID};
        ObexObjectPush, HID, MessageAccessServer, MessageNotificationServer};


    public static boolean isAudioSource(ParcelUuid uuid) {
    public static boolean isAudioSource(ParcelUuid uuid) {
        return uuid.equals(AudioSource);
        return uuid.equals(AudioSource);
@@ -88,6 +92,14 @@ public final class BluetoothUuid {
        return uuid.equals(HID);
        return uuid.equals(HID);
    }
    }


    public static boolean isMessageAccessServer(ParcelUuid uuid) {
        return uuid.equals(MessageAccessServer);
    }

    public static boolean isMessageNotificationServer(ParcelUuid uuid) {
        return uuid.equals(MessageNotificationServer);
    }

    /**
    /**
     * Returns true if ParcelUuid is present in uuidArray
     * Returns true if ParcelUuid is present in uuidArray
     *
     *
+40 −12
Original line number Original line Diff line number Diff line
@@ -35,7 +35,11 @@ public class WimaxHelper {


    private static final String TAG = "WimaxHelper";
    private static final String TAG = "WimaxHelper";


    private static final String WIMAX_CONTROLLER_CLASSNAME = "com.htc.net.wimax.WimaxController";
    private static final String WIMAX_MANAGER_CLASSNAME    = "android.net.wimax.WimaxManager";

    private static DexClassLoader sWimaxClassLoader;
    private static DexClassLoader sWimaxClassLoader;
    private static String sWimaxManagerClassname, sGetWimaxStateMethodname;
    
    
    public static boolean isWimaxSupported(Context context) {
    public static boolean isWimaxSupported(Context context) {
        return context.getResources().getBoolean(
        return context.getResources().getBoolean(
@@ -45,6 +49,17 @@ public class WimaxHelper {
    public static DexClassLoader getWimaxClassLoader(Context context) {
    public static DexClassLoader getWimaxClassLoader(Context context) {
        if (isWimaxSupported(context)) {
        if (isWimaxSupported(context)) {
            if (sWimaxClassLoader == null) {
            if (sWimaxClassLoader == null) {
                sWimaxManagerClassname = context.getResources().getString(
                    com.android.internal.R.string.config_wimaxManagerClassname);

                // WimaxController::getWimaxState == WimaxManager::getWimaxStatus.
                // However, WimaxManager also implements a different getWimaxState method,
                // which returns a WimaxState object describing the connection state, not
                // the enabled state.
                if (sWimaxManagerClassname.equals(WIMAX_CONTROLLER_CLASSNAME))
                    sGetWimaxStateMethodname = "getWimaxState";
                else if (sWimaxManagerClassname.equals(WIMAX_MANAGER_CLASSNAME))
                    sGetWimaxStateMethodname = "getWimaxStatus";


                String wimaxJarLocation = context.getResources().getString(
                String wimaxJarLocation = context.getResources().getString(
                        com.android.internal.R.string.config_wimaxServiceJarLocation);
                        com.android.internal.R.string.config_wimaxServiceJarLocation);
@@ -64,6 +79,8 @@ public class WimaxHelper {
        
        
        try {
        try {
            DexClassLoader wimaxClassLoader = getWimaxClassLoader(context);
            DexClassLoader wimaxClassLoader = getWimaxClassLoader(context);
            if (sWimaxManagerClassname.equals(WIMAX_CONTROLLER_CLASSNAME)) {
                // Load supersonic's and speedy's WimaxController.
                IBinder b = ServiceManager.getService(WimaxManagerConstants.WIMAX_SERVICE);
                IBinder b = ServiceManager.getService(WimaxManagerConstants.WIMAX_SERVICE);
                if (b != null) {
                if (b != null) {
                    Class<?> klass = wimaxClassLoader.loadClass("com.htc.net.wimax.IWimaxController$Stub");
                    Class<?> klass = wimaxClassLoader.loadClass("com.htc.net.wimax.IWimaxController$Stub");
@@ -71,7 +88,7 @@ public class WimaxHelper {
                        Method asInterface = klass.getMethod("asInterface", IBinder.class);
                        Method asInterface = klass.getMethod("asInterface", IBinder.class);
                        Object wc = asInterface.invoke(null, b);
                        Object wc = asInterface.invoke(null, b);
                        if (wc != null) {
                        if (wc != null) {
                        klass = wimaxClassLoader.loadClass("com.htc.net.wimax.WimaxController");
                            klass = wimaxClassLoader.loadClass(WIMAX_CONTROLLER_CLASSNAME);
                            if (klass != null) {
                            if (klass != null) {
                                Constructor<?> ctor = klass.getDeclaredConstructors()[1];
                                Constructor<?> ctor = klass.getDeclaredConstructors()[1];
                                controller = ctor.newInstance(wc, handler);
                                controller = ctor.newInstance(wc, handler);
@@ -79,6 +96,17 @@ public class WimaxHelper {
                        }
                        }
                    }
                    }
                }
                }
            } else if (sWimaxManagerClassname.equals(WIMAX_MANAGER_CLASSNAME)) {
                // Load crespo4g's (and epicmtd's) WimaxManager.
                // Note that crespo4g's implementation grabs WIMAX_SERVICE internally, so
                // it doesn't need to be passed in.  Other implementations (may) require
                // WIMAX_SERVICE to be grabbed externally, so check WimaxManager::<init>.
                Class<?> klass = wimaxClassLoader.loadClass(WIMAX_MANAGER_CLASSNAME);
                if (klass != null) {
                    Constructor<?> ctor = klass.getDeclaredConstructors()[0];
                    controller = ctor.newInstance();
                }
            }
        } catch (Exception e) {
        } catch (Exception e) {
            Log.e(TAG, "Unable to create WimaxController instance", e);
            Log.e(TAG, "Unable to create WimaxController instance", e);
        }
        }
@@ -117,7 +145,7 @@ public class WimaxHelper {
        int ret = 0;
        int ret = 0;
        try {
        try {
            Object wimaxService = context.getSystemService(WimaxManagerConstants.WIMAX_SERVICE);
            Object wimaxService = context.getSystemService(WimaxManagerConstants.WIMAX_SERVICE);
            Method m = wimaxService.getClass().getMethod("getWimaxState");
            Method m = wimaxService.getClass().getMethod(sGetWimaxStateMethodname);
            ret = (Integer) m.invoke(wimaxService);
            ret = (Integer) m.invoke(wimaxService);
        } catch (Exception e) {
        } catch (Exception e) {
            Log.e(TAG, "Unable to get WiMAX state!", e);
            Log.e(TAG, "Unable to get WiMAX state!", e);
+155 −0
Original line number Original line Diff line number Diff line
@@ -68,6 +68,161 @@ public final class CmSystem {
    public static final int KEYCODE_NONE = -1;
    public static final int KEYCODE_NONE = -1;




    public enum LockscreenStyle {
        Slider,
        Rotary,
        Lense,
        Ring;

        static public LockscreenStyle getStyleById(int id) {
            switch (id) {
                case 1:
                    return Slider;
                case 2:
                    return Rotary;
                case 3:
                    /* backwards compat */
                    return Rotary;
                case 4:
                    return Lense;
                case 5:
                    return Ring;
                default:
                    return Ring;
            }
        }

        static public LockscreenStyle getStyleById(String id) {
            return getStyleById(Integer.valueOf(id));
        }

        static public int getIdByStyle(LockscreenStyle lockscreenstyle) {
            switch (lockscreenstyle){
                case Slider:
                    return 1;
                case Rotary:
                    return 2;
                case Lense:
                    return 4;
                case Ring:
                    return 5;
                default:
                    return 5;
            }
        }
    }

    public enum InCallStyle {
        Slider,
        Rotary,
        Ring;

        static public InCallStyle getStyleById(int id) {
            switch (id) {
                case 1:
                    return Slider;
                case 2:
                    return Rotary;
                case 3:
                    /* backwards compat */
                    return Rotary;
                case 4:
                    return Ring;
                default:
                    return Ring;
            }
        }

        static public InCallStyle getStyleById(String id) {
            return getStyleById(Integer.valueOf(id));
        }

        static public int getIdByStyle(InCallStyle inCallStyle) {
            switch (inCallStyle) {
                case Slider:
                    return 1;
                case Rotary:
                    return 2;
                case Ring:
                    return 4;
                default:
                    return 4;
            }
        }
    }

    public enum RotaryStyle {
        Normal,
        Revamped;

        static public RotaryStyle getStyleById(int id) {
            switch (id) {
                case 1:
                    return Normal;
                case 2:
                    return Revamped;
                default:
                    return Normal;
            }
        }

        static public RotaryStyle getStyleById(String id) {
            return getStyleById(Integer.valueOf(id));
        }

        static public int getIdByStyle(RotaryStyle style) {
            switch (style) {
                case Normal:
                    return 1;
                case Revamped:
                    return 2;
                default:
                    return 1;
            }
        }
    }

    public enum RinglockStyle {
        Bubble,
        Revamped,
        Holo,
        Blade;

        static public RinglockStyle getStyleById(int id) {
            switch (id) {
                case 1:
                    return Bubble;
                case 2:
                    return Revamped;
                case 3:
                    return Holo;
                case 4:
                    return Blade;
                default:
                    return Bubble;
            }
        }

        static public RinglockStyle getStyleById(String id) {
            return getStyleById(Integer.valueOf(id));
        }

        static public int getIdByStyle(RinglockStyle style) {
            switch (style) {
                case Bubble:
                    return 1;
                case Revamped:
                    return 2;
                case Holo:
                    return 3;
                case Blade:
                    return 4;
                default:
                    return 1;
            }
        }
    }

    public CmSystem(){
    public CmSystem(){
        //nothing to be done, as long as only static functions in here
        //nothing to be done, as long as only static functions in here
    }
    }
+60 −0
Original line number Original line Diff line number Diff line
@@ -1203,6 +1203,12 @@ public final class Settings {
         */
         */
        public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
        public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";


        /**
         * Whether Bluetooth fast connections are enabled.
         * @hide
         */
        public static final String BLUETOOTH_FAST_CONNECT = "bluetooth_fast_connect";

        /**
        /**
         * The policy for deciding when Wi-Fi should go to sleep (which will in
         * The policy for deciding when Wi-Fi should go to sleep (which will in
         * turn switch to using the mobile data as an Internet connection).
         * turn switch to using the mobile data as an Internet connection).
@@ -1647,6 +1653,13 @@ public final class Settings {
         */
         */
        public static final String VOLUME_CONTROL_SILENT = "volume_contol_silent";
        public static final String VOLUME_CONTROL_SILENT = "volume_contol_silent";


        /**
         * Whether to lock ringer volume changes in silent mode.
         *
         * @hide
         */
        public static final String LOCK_VOLUME_KEYS = "lock_volume_keys";

        /**
        /**
         * Whether notifications should vibrate during phone calls or not.
         * Whether notifications should vibrate during phone calls or not.
         *
         *
@@ -2251,6 +2264,23 @@ public final class Settings {
         */
         */
        public static final String LOCK_MMS_IN_MEMORY = "lock_mms_in_memory";
        public static final String LOCK_MMS_IN_MEMORY = "lock_mms_in_memory";


        /**
         * What text to show as carrier label
         * 0: use system default
         * 1: show spn
         * 2: show plmn
         * 3: show custom string
         * default: 0
         * @hide
         */
        public static final String CARRIER_LABEL_TYPE = "carrier_label_type";

        /**
         * The custom string to show as carrier label
         * @hide
         */
        public static final String CARRIER_LABEL_CUSTOM_STRING = "carrier_label_custom_string";

        /**
        /**
         * Display style of AM/PM next to clock in status bar
         * Display style of AM/PM next to clock in status bar
         * 0: Normal display (Eclair stock)
         * 0: Normal display (Eclair stock)
@@ -2585,6 +2615,18 @@ public final class Settings {
         */
         */
        public static final String IN_CALL_STYLE_PREF = "in_call_style_pref";
        public static final String IN_CALL_STYLE_PREF = "in_call_style_pref";


        /**
         * Sets the rotary lock style
         * @hide
         */
        public static final String ROTARY_STYLE_PREF = "rotary_style_pref";

        /**
         * Sets the ringlock style
         * @hide
         */
        public static final String RINGLOCK_STYLE_PREF = "ringlock_style_pref";

        /**
        /**
         * Pulse the Trackball with Screen On.  The value is boolean (1 or 0).
         * Pulse the Trackball with Screen On.  The value is boolean (1 or 0).
         * @hide
         * @hide
@@ -2846,6 +2888,12 @@ public final class Settings {
        */
        */
        public static final String EXPANDED_FLASH_MODE = "expanded_flash_mode";
        public static final String EXPANDED_FLASH_MODE = "expanded_flash_mode";


        /**
        * Notification Power Widget - Mobile Data Auto 2G/3G Toggle
        * @hide
        */
        public static final String EXPANDED_MOBILEDATANETWORK_MODE = "expanded_mobiledatanetwork_mode";

        /** 
        /** 
        * Enables the Screen-on animation
        * Enables the Screen-on animation
        * @hide
        * @hide
@@ -3527,6 +3575,11 @@ public final class Settings {
         */
         */
        public static final String ADB_ENABLED = "adb_enabled";
        public static final String ADB_ENABLED = "adb_enabled";


        /**
         * The TCP/IP port to run ADB on, or -1 for USB
         */
        public static final String ADB_PORT = "adb_port";

        /**
        /**
         * Whether to show ADB notifications.
         * Whether to show ADB notifications.
         * @hide
         * @hide
@@ -3699,6 +3752,12 @@ public final class Settings {
         */
         */
        public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
        public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
        
        
         /**
         * External BT GPS device
         * @hide
         */
        public static final String EXTERNAL_GPS_BT_DEVICE = "0";

        /**
        /**
         * The Logging ID (a unique 64-bit value) as a hex string.
         * The Logging ID (a unique 64-bit value) as a hex string.
         * Used as a pseudonymous identifier for logging.
         * Used as a pseudonymous identifier for logging.
@@ -5065,4 +5124,5 @@ public final class Settings {
    public static String getGTalkDeviceId(long androidId) {
    public static String getGTalkDeviceId(long androidId) {
        return "android-" + Long.toHexString(androidId);
        return "android-" + Long.toHexString(androidId);
    }
    }
    
}
}
Loading