Merge commit '513ae3610e5d6eac3af71c3e51a4e5e8b55b5256' into froyo-plus-aosp * commit '513ae3610e5d6eac3af71c3e51a4e5e8b55b5256': Fix issue #2560791: Expose API to go in to car mode.
This commit is contained in:
@@ -25351,6 +25351,19 @@
|
||||
<parameter name="flags" type="int">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="enableCarMode"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="flags" type="int">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="getCurrentModeType"
|
||||
return="int"
|
||||
abstract="false"
|
||||
|
||||
@@ -124,6 +124,22 @@ public class UiModeManager {
|
||||
*/
|
||||
public static final int DISABLE_CAR_MODE_GO_HOME = 0x0001;
|
||||
|
||||
/**
|
||||
* Force device into car mode, like it had been placed in the car dock.
|
||||
* This will cause the device to switch to the car home UI as part of
|
||||
* the mode switch.
|
||||
* @param flags Must be 0.
|
||||
*/
|
||||
public void enableCarMode(int flags) {
|
||||
if (mService != null) {
|
||||
try {
|
||||
mService.enableCarMode();
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "disableCarMode: RemoteException", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn off special mode if currently in car mode.
|
||||
* @param flags May be 0 or {@link #DISABLE_CAR_MODE_GO_HOME}.
|
||||
|
||||
@@ -562,14 +562,6 @@
|
||||
android:label="@string/permlab_changeConfiguration"
|
||||
android:description="@string/permdesc_changeConfiguration" />
|
||||
|
||||
<!-- Allows an application to enable the car mode.
|
||||
@hide -->
|
||||
<permission android:name="android.permission.ENABLE_CAR_MODE"
|
||||
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
|
||||
android:protectionLevel="signature"
|
||||
android:label="@string/permlab_enableCarMode"
|
||||
android:description="@string/permdesc_enableCarMode" />
|
||||
|
||||
<!-- @deprecated The {@link android.app.ActivityManager#restartPackage}
|
||||
API is no longer supported. -->
|
||||
<permission android:name="android.permission.RESTART_PACKAGES"
|
||||
|
||||
@@ -19,14 +19,12 @@ package com.android.server;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.AlarmManager;
|
||||
import android.app.IActivityManager;
|
||||
import android.app.IUiModeManager;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.StatusBarManager;
|
||||
import android.app.UiModeManager;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -310,9 +308,6 @@ class UiModeManagerService extends IUiModeManager.Stub {
|
||||
}
|
||||
|
||||
public void enableCarMode() {
|
||||
mContext.enforceCallingOrSelfPermission(
|
||||
android.Manifest.permission.ENABLE_CAR_MODE,
|
||||
"Need ENABLE_CAR_MODE permission");
|
||||
synchronized (mLock) {
|
||||
setCarModeLocked(true);
|
||||
if (mSystemReady) {
|
||||
@@ -394,7 +389,7 @@ class UiModeManagerService extends IUiModeManager.Stub {
|
||||
} else if (mDockState == Intent.EXTRA_DOCK_STATE_DESK) {
|
||||
uiMode = Configuration.UI_MODE_TYPE_DESK;
|
||||
}
|
||||
if (uiMode != 0) {
|
||||
if (mCarModeEnabled) {
|
||||
if (mNightMode == UiModeManager.MODE_NIGHT_AUTO) {
|
||||
updateTwilightLocked();
|
||||
uiMode |= mComputedNightMode ? Configuration.UI_MODE_NIGHT_YES
|
||||
|
||||
Reference in New Issue
Block a user