diff options
| author | Brian Floersch <gh123man@gmail.com> | 2012-12-17 16:53:30 +0700 |
|---|---|---|
| committer | Pawit Pornkitprasan <p.pawit@gmail.com> | 2012-12-18 20:35:22 +0700 |
| commit | d8f4be7640b2219aebc7bf8cd8c17dcbeaa44ad6 (patch) | |
| tree | 44bd279588996337e4b173031d54bf49330de10b /services/java/com/android/server/SystemServer.java | |
| parent | f02826474592b3e3fbc2d533e31c5bab3041429e (diff) | |
| download | frameworks_base-d8f4be7640b2219aebc7bf8cd8c17dcbeaa44ad6.zip frameworks_base-d8f4be7640b2219aebc7bf8cd8c17dcbeaa44ad6.tar.gz frameworks_base-d8f4be7640b2219aebc7bf8cd8c17dcbeaa44ad6.tar.bz2 | |
Add support for HW Rotation Lock
Forward ported from jellybean
Change-Id: I75fb9fa33541eb6acedd62a67e74977b36768390
Diffstat (limited to 'services/java/com/android/server/SystemServer.java')
| -rw-r--r-- | services/java/com/android/server/SystemServer.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index a2d8355..9decd62 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -160,6 +160,7 @@ class ServerThread extends Thread { WindowManagerService wm = null; BluetoothManagerService bluetooth = null; DockObserver dock = null; + RotationSwitchObserver rotateSwitch = null; UsbService usb = null; SerialService serial = null; TwilightService twilight = null; @@ -360,6 +361,9 @@ class ServerThread extends Thread { Slog.e("System", "************ Failure starting core service", e); } + boolean hasRotationLock = context.getResources().getBoolean(com.android + .internal.R.bool.config_hasRotationLockSwitch); + DevicePolicyManagerService devicePolicy = null; StatusBarManagerService statusBar = null; InputMethodManagerService imm = null; @@ -659,7 +663,17 @@ class ServerThread extends Thread { } try { - Slog.i(TAG, "Wired Accessory Manager"); + if (hasRotationLock) { + Slog.i(TAG, "Rotation Switch Observer"); + // Listen for switch changes + rotateSwitch = new RotationSwitchObserver(context); + } + } catch (Throwable e) { + reportWtf("starting RotationSwitchObserver", e); + } + + try { + Slog.i(TAG, "Wired Accessory Observer"); // Listen for wired headset changes inputManager.setWiredAccessoryCallbacks( new WiredAccessoryManager(context, inputManager)); @@ -892,6 +906,7 @@ class ServerThread extends Thread { final NetworkPolicyManagerService networkPolicyF = networkPolicy; final ConnectivityService connectivityF = connectivity; final DockObserver dockF = dock; + final RotationSwitchObserver rotateSwitchF = rotateSwitch; final UsbService usbF = usb; final ThrottleService throttleF = throttle; final TwilightService twilightF = twilight; @@ -956,6 +971,11 @@ class ServerThread extends Thread { reportWtf("making Dock Service ready", e); } try { + if (rotateSwitchF != null) rotateSwitchF.systemReady(); + } catch (Throwable e) { + reportWtf("making Rotation Switch Service ready", e); + } + try { if (usbF != null) usbF.systemReady(); } catch (Throwable e) { reportWtf("making USB Service ready", e); |
