summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/ActivityManager.java39
-rw-r--r--core/java/android/provider/Settings.java5
-rw-r--r--core/java/android/text/method/QwertyKeyListener.java2
-rw-r--r--core/java/android/view/HardwareRenderer.java8
-rw-r--r--core/java/com/android/internal/app/ShutdownThread.java78
-rw-r--r--core/java/com/android/internal/os/ProcessStats.java2
-rw-r--r--core/jni/Android.mk4
-rw-r--r--core/jni/android_database_SQLiteDatabase.cpp67
-rw-r--r--core/jni/android_net_TrafficStats.cpp3
-rw-r--r--core/res/res/drawable-hdpi/ic_lock_reboot.pngbin0 -> 1645 bytes
-rw-r--r--core/res/res/drawable-hdpi/ic_lock_screenshot.pngbin0 -> 1677 bytes
-rw-r--r--core/res/res/drawable-ldpi/ic_lock_reboot.pngbin0 -> 1186 bytes
-rw-r--r--core/res/res/drawable-ldpi/ic_lock_screenshot.pngbin0 -> 968 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_lock_reboot.pngbin0 -> 3374 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_lock_screenshot.pngbin0 -> 1517 bytes
-rw-r--r--core/res/res/drawable-xhdpi/ic_lock_reboot.pngbin0 -> 2221 bytes
-rw-r--r--core/res/res/drawable-xhdpi/ic_lock_screenshot.pngbin0 -> 2263 bytes
-rw-r--r--core/res/res/values/arrays.xml15
-rwxr-xr-xcore/res/res/values/strings.xml28
-rw-r--r--libs/ui/GraphicBufferAllocator.cpp10
-rw-r--r--libs/ui/GraphicBufferMapper.cpp13
-rw-r--r--media/libmedia/Android.mk11
-rw-r--r--media/libmedia/AudioRecord.cpp32
-rw-r--r--media/libmedia/AudioSystem.cpp60
-rw-r--r--media/libmedia/AudioTrack.cpp32
-rw-r--r--media/libstagefright/colorconversion/SoftwareRenderer.cpp2
-rw-r--r--opengl/include/GLES/glext.h4
-rw-r--r--opengl/include/GLES2/gl2ext.h4
-rw-r--r--opengl/libagl/Android.mk3
-rw-r--r--opengl/libagl/state.cpp2
-rw-r--r--opengl/libs/Android.mk18
-rw-r--r--opengl/libs/GLES2/gl2.cpp11
-rw-r--r--opengl/libs/GLES_CM/gl.cpp11
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java14
-rw-r--r--policy/src/com/android/internal/policy/impl/GlobalActions.java129
-rw-r--r--services/input/Android.mk4
-rw-r--r--services/input/InputReader.cpp62
-rw-r--r--services/java/com/android/server/DeviceStorageMonitorService.java6
-rw-r--r--services/java/com/android/server/MountService.java122
-rw-r--r--services/java/com/android/server/pm/PackageManagerService.java14
-rwxr-xr-x[-rw-r--r--]services/java/com/android/server/wm/WindowManagerService.java2
-rw-r--r--services/sensorservice/Android.mk23
-rw-r--r--services/sensorservice/SensorDevice.cpp220
-rw-r--r--services/sensorservice/SensorDevice.h7
-rw-r--r--services/sensorservice/sensors_deprecated.h75
-rw-r--r--services/surfaceflinger/Android.mk6
-rw-r--r--services/surfaceflinger/DisplayHardware/DisplayHardware.cpp4
-rw-r--r--services/surfaceflinger/Layer.cpp5
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp10
-rw-r--r--telephony/java/com/android/internal/telephony/DataCallState.java2
-rw-r--r--telephony/java/com/android/internal/telephony/PhoneBase.java5
-rw-r--r--telephony/java/com/android/internal/telephony/RIL.java191
53 files changed, 1199 insertions, 168 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 4fe9cef..fdf8921 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -212,26 +212,33 @@ public class ActivityManager {
/**
* Used by persistent processes to determine if they are running on a
* higher-end device so should be okay using hardware drawing acceleration
- * (which tends to consume a lot more RAM).
+ * (which tends to consume a lot more RAM). Alternatively, setting
+ * ro.config.disable_hw_accel=true disables hardware acceleration even if the
+ * device meets the other criteria since not all devices currently have
+ * the ability to support it.
* @hide
*/
static public boolean isHighEndGfx(Display display) {
- MemInfoReader reader = new MemInfoReader();
- reader.readMemInfo();
- if (reader.getTotalSize() >= (512*1024*1024)) {
- // If the device has at least 512MB RAM available to the kernel,
- // we can afford the overhead of graphics acceleration.
- return true;
- }
- Point p = new Point();
- display.getRealSize(p);
- int pixels = p.x * p.y;
- if (pixels >= (1024*600)) {
- // If this is a sufficiently large screen, then there are enough
- // pixels on it that we'd really like to use hw drawing.
- return true;
+ if (SystemProperties.get("ro.config.disable_hw_accel").equals("true")) {
+ return false;
+ } else {
+ MemInfoReader reader = new MemInfoReader();
+ reader.readMemInfo();
+ if (reader.getTotalSize() >= (512*1024*1024)) {
+ // If the device has at least 512MB RAM available to the kernel,
+ // we can afford the overhead of graphics acceleration.
+ return true;
+ }
+ Point p = new Point();
+ display.getRealSize(p);
+ int pixels = p.x * p.y;
+ if (pixels >= (1024*600)) {
+ // If this is a sufficiently large screen, then there are enough
+ // pixels on it that we'd really like to use hw drawing.
+ return true;
+ }
+ return false;
}
- return false;
}
/**
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 65b4e7e..fdcca3c 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -1874,6 +1874,11 @@ public final class Settings {
public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME";
/**
+ * Torch state (flashlight)
+ * @hide
+ */
+ public static final String TORCH_STATE = "torch_state";
+ /**
* Pointer speed setting.
* This is an integer value in a range between -7 and +7, so there are 15 possible values.
* -7 = slowest
diff --git a/core/java/android/text/method/QwertyKeyListener.java b/core/java/android/text/method/QwertyKeyListener.java
index 4c82b81..192257b 100644
--- a/core/java/android/text/method/QwertyKeyListener.java
+++ b/core/java/android/text/method/QwertyKeyListener.java
@@ -457,7 +457,7 @@ public class QwertyKeyListener extends BaseKeyListener {
PICKER_SETS.put('y', "\u00FD\u00FF");
PICKER_SETS.put('z', "\u017A\u017C\u017E");
PICKER_SETS.put(KeyCharacterMap.PICKER_DIALOG_INPUT,
- "\u2026\u00A5\u2022\u00AE\u00A9\u00B1[]{}\\|");
+ "\u2026\u00A5\u2022\u00AE\u00A9\u00B1[]{}<>`^\\|");
PICKER_SETS.put('/', "\\");
// From packages/inputmethods/LatinIME/res/xml/kbd_symbols.xml
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index ccb6489..52ffdf1 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -904,6 +904,14 @@ public abstract class HardwareRenderer {
fallback(true);
return SURFACE_STATE_ERROR;
} else {
+ /**
+ * Need to make sure preserve_buff swap is set properly for this context
+ */
+ if (sDirtyRegions) {
+ if (!(mDirtyRegionsEnabled = GLES20Canvas.preserveBackBuffer())) {
+ Log.w(LOG_TAG, "Backbuffer cannot be preserved");
+ }
+ }
return SURFACE_STATE_UPDATED;
}
}
diff --git a/core/java/com/android/internal/app/ShutdownThread.java b/core/java/com/android/internal/app/ShutdownThread.java
index 77d0c97..d445ab4 100644
--- a/core/java/com/android/internal/app/ShutdownThread.java
+++ b/core/java/com/android/internal/app/ShutdownThread.java
@@ -43,6 +43,7 @@ import android.os.storage.IMountShutdownObserver;
import com.android.internal.telephony.ITelephony;
import android.util.Log;
import android.view.WindowManager;
+import android.view.KeyEvent;
public final class ShutdownThread extends Thread {
// constants
@@ -107,19 +108,61 @@ public final class ShutdownThread extends Thread {
Log.d(TAG, "Notifying thread to start shutdown longPressBehavior=" + longPressBehavior);
if (confirm) {
- final CloseDialogReceiver closer = new CloseDialogReceiver(context);
- final AlertDialog dialog = new AlertDialog.Builder(context)
- .setTitle(com.android.internal.R.string.power_off)
- .setMessage(resourceId)
- .setPositiveButton(com.android.internal.R.string.yes, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- beginShutdownSequence(context);
- }
- })
- .setNegativeButton(com.android.internal.R.string.no, null)
- .create();
- closer.dialog = dialog;
- dialog.setOnDismissListener(closer);
+ final AlertDialog dialog;
+ // Set different dialog message based on whether or not we're rebooting
+ if (mReboot) {
+ dialog = new AlertDialog.Builder(context)
+ .setIcon(android.R.drawable.ic_dialog_alert)
+ .setTitle(com.android.internal.R.string.reboot_system)
+ .setSingleChoiceItems(com.android.internal.R.array.shutdown_reboot_options, 0, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ if (which < 0)
+ return;
+
+ String actions[] = context.getResources().getStringArray(com.android.internal.R.array.shutdown_reboot_actions);
+
+ if (actions != null && which < actions.length)
+ mRebootReason = actions[which];
+ }
+ })
+ .setPositiveButton(com.android.internal.R.string.yes, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ mReboot = true;
+ beginShutdownSequence(context);
+ }
+ })
+ .setNegativeButton(com.android.internal.R.string.no, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ mReboot = false;
+ dialog.cancel();
+ }
+ })
+ .create();
+ dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
+ public boolean onKey (DialogInterface dialog, int keyCode, KeyEvent event) {
+ if (keyCode == KeyEvent.KEYCODE_BACK) {
+ mReboot = false;
+ dialog.cancel();
+ }
+ return true;
+ }
+ });
+ // Initialize to the first reason
+ String actions[] = context.getResources().getStringArray(com.android.internal.R.array.shutdown_reboot_actions);
+ mRebootReason = actions[0];
+ } else {
+ dialog = new AlertDialog.Builder(context)
+ .setIcon(android.R.drawable.ic_dialog_alert)
+ .setTitle(com.android.internal.R.string.power_off)
+ .setMessage(com.android.internal.R.string.shutdown_confirm)
+ .setPositiveButton(com.android.internal.R.string.yes, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ beginShutdownSequence(context);
+ }
+ })
+ .setNegativeButton(com.android.internal.R.string.no, null)
+ .create();
+ }
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
dialog.show();
} else {
@@ -175,8 +218,13 @@ public final class ShutdownThread extends Thread {
// throw up an indeterminate system dialog to indicate radio is
// shutting down.
ProgressDialog pd = new ProgressDialog(context);
- pd.setTitle(context.getText(com.android.internal.R.string.power_off));
- pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress));
+ if (mReboot) {
+ pd.setTitle(context.getText(com.android.internal.R.string.reboot_system));
+ pd.setMessage(context.getText(com.android.internal.R.string.reboot_progress));
+ } else {
+ pd.setTitle(context.getText(com.android.internal.R.string.power_off));
+ pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress));
+ }
pd.setIndeterminate(true);
pd.setCancelable(false);
pd.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
diff --git a/core/java/com/android/internal/os/ProcessStats.java b/core/java/com/android/internal/os/ProcessStats.java
index e0e9a29..97e65a8 100644
--- a/core/java/com/android/internal/os/ProcessStats.java
+++ b/core/java/com/android/internal/os/ProcessStats.java
@@ -154,7 +154,7 @@ public class ProcessStats {
private boolean mFirst = true;
- private byte[] mBuffer = new byte[256];
+ private byte[] mBuffer = new byte[512];
/**
* The time in microseconds that the CPU has been running at each speed.
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 71c5d26..863c536 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -244,6 +244,10 @@ endif
LOCAL_MODULE:= libandroid_runtime
+ifneq ($(BOARD_MOBILEDATA_INTERFACE_NAME),)
+ LOCAL_CFLAGS += -DMOBILE_IFACE_NAME='$(BOARD_MOBILEDATA_INTERFACE_NAME)'
+endif
+
include $(BUILD_SHARED_LIBRARY)
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/core/jni/android_database_SQLiteDatabase.cpp b/core/jni/android_database_SQLiteDatabase.cpp
index e0c900e..fea7763 100644
--- a/core/jni/android_database_SQLiteDatabase.cpp
+++ b/core/jni/android_database_SQLiteDatabase.cpp
@@ -35,6 +35,7 @@
#include <ctype.h>
#include <stdio.h>
+#include <libgen.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -98,6 +99,35 @@ static void registerLoggingFunc(const char *path) {
loggingFuncSet = true;
}
+static int use_wal_mode (char const *path8)
+{
+ char *temp = basename(path8);
+ int i;
+ const char *wal_dbs[] = {
+ "database_test.db","contacts2.db","calendar.db",\
+ "telephony.db","launcher.db","user_dict.db",\
+ "downloads.db", "mmssms.db", "internal.db", \
+ "EmailProvider.db","alarms.db","EmailProviderBody.db",\
+ "btopp.db","picasa.db",\
+ "webviewCache.db","browser.db", NULL};
+
+ const char *wal_dbs_nosync[] = {
+ "webview.db", "quadrant.db", \
+ "MyDatabase.db", NULL};
+
+ for (i = 0 ; wal_dbs[i]!= NULL ; i++) {
+ if(strcmp(temp, wal_dbs[i]) == 0)
+ return 1;
+ }
+
+ for (i = 0 ; wal_dbs_nosync[i]!= NULL ; i++) {
+ if(strcmp(temp, wal_dbs_nosync[i]) == 0)
+ return 2;
+ }
+
+ return 0;
+}
+
/* public native void dbopen(String path, int flags, String locale); */
static void dbopen(JNIEnv* env, jobject object, jstring pathString, jint flags)
{
@@ -106,6 +136,8 @@ static void dbopen(JNIEnv* env, jobject object, jstring pathString, jint flags)
sqlite3_stmt * statement = NULL;
char const * path8 = env->GetStringUTFChars(pathString, NULL);
int sqliteFlags;
+ // Error code handling for SQLite exec
+ char* zErrMsg = NULL;
// register the logging func on sqlite. needs to be done BEFORE any sqlite3 func is called.
registerLoggingFunc(path8);
@@ -126,6 +158,41 @@ static void dbopen(JNIEnv* env, jobject object, jstring pathString, jint flags)
goto done;
}
+ // WAL is a new rollback method available in SQLite v3.7+. WAL speeds up writes to
+ // SQLite databases. WAL cannot be used with Read Only databases or databases opened
+ // in read only mode.
+
+ // Check if DB can use WAL mode; Open in WAL mode for non-ReadOnly DBs
+ if(!(flags & OPEN_READONLY) && (use_wal_mode(path8))) {
+ // Configure databases to run in WAL mode.
+ err = sqlite3_exec(handle,"PRAGMA journal_mode = WAL;",
+ NULL, NULL,&zErrMsg);
+ if (SQLITE_OK != err) {
+ LOGE("sqlite3_exec - Failed to set WAL mode for [%s] \n", path8);
+ err = sqlite3_exec(handle,"PRAGMA journal_mode = DELETE;",
+ NULL, NULL,&zErrMsg);
+ if(SQLITE_OK != err) {
+ LOGE("sqlite3_exec - Failed to set DELETE mode for [%s] \n", path8);
+ throw_sqlite3_exception(env, handle);
+ goto done;
+ }
+ }
+ else {
+ // Set autocheckpoint = 100 pages
+ err = sqlite3_wal_autocheckpoint(handle,
+ 100);
+ if (SQLITE_OK != err) {
+ LOGE("sqlite3_exec to set WAL autocheckpoint failed\n");
+ throw_sqlite3_exception(env, handle);
+ goto done;
+ } else if (use_wal_mode(path8) == 2) {
+ /* Try to disable fsyncs. We don't care if it fails */
+ sqlite3_exec(handle,"PRAGMA synchronous = OFF;",
+ NULL, NULL,&zErrMsg);
+ }
+ }
+ }
+
// The soft heap limit prevents the page cache allocations from growing
// beyond the given limit, no matter what the max page cache sizes are
// set to. The limit does not, as of 3.5.0, affect any other allocations.
diff --git a/core/jni/android_net_TrafficStats.cpp b/core/jni/android_net_TrafficStats.cpp
index 7a61432..1e3cf6d 100644
--- a/core/jni/android_net_TrafficStats.cpp
+++ b/core/jni/android_net_TrafficStats.cpp
@@ -64,6 +64,9 @@ static jlong readNumber(char const* filename) {
}
static const char* mobile_iface_list[] = {
+#ifdef MOBILE_IFACE_NAME
+ MOBILE_IFACE_NAME,
+#endif
"rmnet0",
"rmnet1",
"rmnet2",
diff --git a/core/res/res/drawable-hdpi/ic_lock_reboot.png b/core/res/res/drawable-hdpi/ic_lock_reboot.png
new file mode 100644
index 0000000..ca00936
--- /dev/null
+++ b/core/res/res/drawable-hdpi/ic_lock_reboot.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_lock_screenshot.png b/core/res/res/drawable-hdpi/ic_lock_screenshot.png
new file mode 100644
index 0000000..f7e3856
--- /dev/null
+++ b/core/res/res/drawable-hdpi/ic_lock_screenshot.png
Binary files differ
diff --git a/core/res/res/drawable-ldpi/ic_lock_reboot.png b/core/res/res/drawable-ldpi/ic_lock_reboot.png
new file mode 100644
index 0000000..b96d099
--- /dev/null
+++ b/core/res/res/drawable-ldpi/ic_lock_reboot.png
Binary files differ
diff --git a/core/res/res/drawable-ldpi/ic_lock_screenshot.png b/core/res/res/drawable-ldpi/ic_lock_screenshot.png
new file mode 100644
index 0000000..60e91ef
--- /dev/null
+++ b/core/res/res/drawable-ldpi/ic_lock_screenshot.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lock_reboot.png b/core/res/res/drawable-mdpi/ic_lock_reboot.png
new file mode 100644
index 0000000..2b125b9
--- /dev/null
+++ b/core/res/res/drawable-mdpi/ic_lock_reboot.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lock_screenshot.png b/core/res/res/drawable-mdpi/ic_lock_screenshot.png
new file mode 100644
index 0000000..bea04d1
--- /dev/null
+++ b/core/res/res/drawable-mdpi/ic_lock_screenshot.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lock_reboot.png b/core/res/res/drawable-xhdpi/ic_lock_reboot.png
new file mode 100644
index 0000000..f27e5e4
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/ic_lock_reboot.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lock_screenshot.png b/core/res/res/drawable-xhdpi/ic_lock_screenshot.png
new file mode 100644
index 0000000..62ef7f2
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/ic_lock_screenshot.png
Binary files differ
diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml
index f9e1f5b..bf1ddac 100644
--- a/core/res/res/values/arrays.xml
+++ b/core/res/res/values/arrays.xml
@@ -511,4 +511,19 @@
<item>@null</item>
</array>
+ <!-- Defines the shutdown options shown in the reboot dialog. -->
+ <array name="shutdown_reboot_options" translatable="false">
+ <item>@string/reboot_reboot</item>
+ <item>@string/reboot_recovery</item>
+ <item>@string/reboot_bootloader</item>
+ </array>
+
+ <!-- Do not translate. Defines the shutdown actions passed to the kernel.
+ The first item should be empty for regular reboot. -->
+ <string-array name="shutdown_reboot_actions" translatable="false">
+ <item></item>
+ <item>recovery</item>
+ <item>bootloader</item>
+ </string-array>
+
</resources>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 7b785ec..6d779aa 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -286,6 +286,31 @@
<string name="screen_lock">Screen lock</string>
<!-- Button to turn off the phone, within the Phone Options dialog -->
<string name="power_off">Power off</string>
+
+ <!-- Button to reboot the phone, within the Phone Options dialog -->
+ <string name="reboot_system">Reboot phone</string>
+
+ <!-- label for item that screenshots in phone options dialog -->
+ <string name="global_action_screenshot">Screenshot</string>
+
+ <!-- Button to reboot the phone, within the Reboot Options dialog -->
+ <string name="reboot_reboot">Reboot</string>
+ <!-- Button to reboot the phone into recovery, within the Reboot Options dialog -->
+ <string name="reboot_recovery">Recovery</string>
+ <!-- Button to reboot the phone into bootloader, within the Reboot Options dialog -->
+ <string name="reboot_bootloader">Bootloader</string>
+ <!-- Button to reboot the phone into bootmenu, within the Reboot Options dialog -->
+ <string name="reboot_bootmenu">Bootmenu</string>
+ <!-- Button to reboot the phone into fastboot, within the Reboot Options dialog -->
+ <string name="reboot_fastboot">Fastboot</string>
+ <!-- Button to reboot the phone into download, within the Reboot Options dialog -->
+ <string name="reboot_download">Download</string>
+
+ <!-- Reboot Progress Dialog. This is shown if the user chooses to reboot the phone. -->
+ <string name="reboot_progress">Rebooting\u2026</string>
+ <!-- Reboot Confirmation Dialog. When the user chooses to reboot the phone, there will be a confirmation dialog. This is the message. -->
+ <string name="reboot_confirm">Your phone will reboot.</string>
+
<!-- Spoken description for ringer silent option. [CHAR LIMIT=NONE] -->
<string name="silent_mode_silent">Ringer off</string>
<!-- Spoken description for ringer vibrate option. [CHAR LIMIT=NONE] -->
@@ -331,6 +356,9 @@
<!-- label for item that turns off power in phone options dialog -->
<string name="global_action_power_off">Power off</string>
+ <!-- label for item that reboots the phone in phone options dialog -->
+ <string name="global_action_reboot">Reboot</string>
+
<!-- label for item that enables silent mode in phone options dialog -->
<string name="global_action_toggle_silent_mode">Silent mode</string>
diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp
index e75415b..f7c4f4e 100644
--- a/libs/ui/GraphicBufferAllocator.cpp
+++ b/libs/ui/GraphicBufferAllocator.cpp
@@ -98,7 +98,15 @@ status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat forma
// we have a h/w allocator and h/w buffer is requested
status_t err;
-
+
+#ifdef MISSING_EGL_PIXEL_FORMAT_YV12
+ if (format == HAL_PIXEL_FORMAT_YV12) {
+ format = HAL_PIXEL_FORMAT_RGBX_8888;
+ }
+ if (usage & GRALLOC_USAGE_EXTERNAL_DISP) {
+ usage ^= GRALLOC_USAGE_EXTERNAL_DISP;
+ }
+#endif
err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride);
LOGW_IF(err, "alloc(%u, %u, %d, %08x, ...) failed %d (%s)",
diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp
index 07c0674..8bf20e9 100644
--- a/libs/ui/GraphicBufferMapper.cpp
+++ b/libs/ui/GraphicBufferMapper.cpp
@@ -70,10 +70,23 @@ status_t GraphicBufferMapper::lock(buffer_handle_t handle,
int usage, const Rect& bounds, void** vaddr)
{
status_t err;
+#ifdef MISSING_GRALLOC_BUFFERS
+ int tries=5;
+#endif
err = mAllocMod->lock(mAllocMod, handle, usage,
bounds.left, bounds.top, bounds.width(), bounds.height(),
vaddr);
+#ifdef MISSING_GRALLOC_BUFFERS
+ while (err && tries) {
+ usleep(1000);
+ err = mAllocMod->unlock(mAllocMod, handle);
+ err = mAllocMod->lock(mAllocMod, handle, usage,
+ bounds.left, bounds.top, bounds.width(), bounds.height(),
+ vaddr);
+ tries--;
+ }
+#endif
LOGW_IF(err, "lock(...) failed %d (%s)", err, strerror(-err));
return err;
diff --git a/media/libmedia/Android.mk b/media/libmedia/Android.mk
index 7af4a87..9ca1a24 100644
--- a/media/libmedia/Android.mk
+++ b/media/libmedia/Android.mk
@@ -46,11 +46,22 @@ LOCAL_SRC_FILES:= \
MemoryLeakTrackUtil.cpp \
fixedfft.cpp.arm
+ifeq ($(BOARD_USES_AUDIO_LEGACY),true)
+ LOCAL_SRC_FILES+= \
+ AudioParameter.cpp
+
+ LOCAL_CFLAGS += -DUSES_AUDIO_LEGACY
+ ifeq ($(BOARD_USE_KINETO_COMPATIBILITY),true)
+ LOCAL_CFLAGS += -DUSE_KINETO_COMPATIBILITY
+ endif
+endif
+
LOCAL_SHARED_LIBRARIES := \
libui libcutils libutils libbinder libsonivox libicuuc libexpat \
libcamera_client libstagefright_foundation \
libgui libdl
+
LOCAL_WHOLE_STATIC_LIBRARY := libmedia_helper
LOCAL_MODULE:= libmedia
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index e5062ab..de3e6af 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -101,6 +101,38 @@ AudioRecord::AudioRecord(
frameCount, flags, cbf, user, notificationFrames, sessionId);
}
+#ifdef USE_KINETO_COMPATIBILITY
+// Really dirty hack to give a Froyo-compatible constructor
+extern "C" AudioRecord *_ZN7android11AudioRecordC1EijijijPFviPvS1_ES1_ii(
+ AudioRecord *This,
+ int inputSource,
+ uint32_t sampleRate,
+ int format,
+ uint32_t channels,
+ int frameCount,
+ uint32_t flags,
+ AudioRecord::callback_t cbf,
+ void* user,
+ int notificationFrames,
+ int sessionId);
+extern "C" AudioRecord *_ZN7android11AudioRecordC1EijijijPFviPvS1_ES1_i(
+ AudioRecord *This,
+ int inputSource,
+ uint32_t sampleRate,
+ int format,
+ uint32_t channels,
+ int frameCount,
+ uint32_t flags,
+ AudioRecord::callback_t cbf,
+ void* user,
+ int notificationFrames)
+{
+ return _ZN7android11AudioRecordC1EijijijPFviPvS1_ES1_ii(This,
+ inputSource, sampleRate, format, channels,
+ frameCount, flags, cbf, user, notificationFrames, 0);
+}
+#endif
+
AudioRecord::~AudioRecord()
{
if (mStatus == NO_ERROR) {
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index 7b14c18..7d28b6f 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -750,5 +750,65 @@ void AudioSystem::AudioPolicyServiceClient::binderDied(const wp<IBinder>& who) {
LOGW("AudioPolicyService server died!");
}
+#ifdef USES_AUDIO_LEGACY
+extern "C" uint32_t _ZN7android11AudioSystem8popCountEj(uint32_t u)
+{
+ return popcount(u);
+}
+
+extern "C" bool _ZN7android11AudioSystem12isA2dpDeviceENS0_13audio_devicesE(uint32_t device)
+{
+ return audio_is_a2dp_device((audio_devices_t)device);
+}
+
+extern "C" bool _ZN7android11AudioSystem13isInputDeviceENS0_13audio_devicesE(uint32_t device)
+{
+ return audio_is_input_device((audio_devices_t)device);
+}
+
+extern "C" bool _ZN7android11AudioSystem14isOutputDeviceENS0_13audio_devicesE(uint32_t device)
+{
+ return audio_is_output_device((audio_devices_t)device);
+}
+
+extern "C" bool _ZN7android11AudioSystem20isBluetoothScoDeviceENS0_13audio_devicesE(uint32_t device)
+{
+ return audio_is_bluetooth_sco_device((audio_devices_t)device);
+}
+
+extern "C" status_t _ZN7android11AudioSystem24setDeviceConnectionStateENS0_13audio_devicesENS0_23device_connection_stateEPKc(audio_devices_t device,
+ audio_policy_dev_state_t state,
+ const char *device_address)
+{
+ return AudioSystem::setDeviceConnectionState(device, state, device_address);
+}
+
+extern "C" audio_io_handle_t _ZN7android11AudioSystem9getOutputENS0_11stream_typeEjjjNS0_12output_flagsE(audio_stream_type_t stream,
+ uint32_t samplingRate,
+ uint32_t format,
+ uint32_t channels,
+ audio_policy_output_flags_t flags)
+{
+ return AudioSystem::getOutput(stream,samplingRate,format,channels>>2,flags);
+}
+
+extern "C" bool _ZN7android11AudioSystem11isLinearPCMEj(uint32_t format)
+{
+ return audio_is_linear_pcm(format);
+}
+
+extern "C" bool _ZN7android11AudioSystem15isLowVisibilityENS0_11stream_typeE(audio_stream_type_t stream)
+{
+ if (stream == AUDIO_STREAM_SYSTEM ||
+ stream == AUDIO_STREAM_NOTIFICATION ||
+ stream == AUDIO_STREAM_RING) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+#endif // AUDIO_LEGACY
+
}; // namespace android
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 8ebb652..31440dd 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -78,6 +78,38 @@ status_t AudioTrack::getMinFrameCount(
// ---------------------------------------------------------------------------
+#ifdef USE_KINETO_COMPATIBILITY
+// Really dirty hack to give a Froyo-compatible constructor
+extern "C" AudioTrack *_ZN7android10AudioTrackC1EijiiijPFviPvS1_ES1_ii(
+ AudioTrack *This,
+ int streamType,
+ uint32_t sampleRate,
+ int format,
+ int channels,
+ int frameCount,
+ uint32_t flags,
+ AudioTrack::callback_t cbf,
+ void* user,
+ int notificationFrames,
+ int sessionId);
+extern "C" AudioTrack *_ZN7android10AudioTrackC1EijiiijPFviPvS1_ES1_i(
+ AudioTrack *This,
+ int streamType,
+ uint32_t sampleRate,
+ int format,
+ int channels,
+ int frameCount,
+ uint32_t flags,
+ AudioTrack::callback_t cbf,
+ void* user,
+ int notificationFrames)
+{
+ return _ZN7android10AudioTrackC1EijiiijPFviPvS1_ES1_ii(This,
+ streamType, sampleRate, format, channels,
+ frameCount, flags, cbf, user, notificationFrames, 0);
+}
+#endif
+
AudioTrack::AudioTrack()
: mStatus(NO_INIT)
{
diff --git a/media/libstagefright/colorconversion/SoftwareRenderer.cpp b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
index 3246021..af8cab7 100644
--- a/media/libstagefright/colorconversion/SoftwareRenderer.cpp
+++ b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
@@ -62,6 +62,7 @@ SoftwareRenderer::SoftwareRenderer(
size_t bufWidth, bufHeight;
switch (mColorFormat) {
+#ifndef MISSING_EGL_PIXEL_FORMAT_YV12
case OMX_COLOR_FormatYUV420Planar:
case OMX_TI_COLOR_FormatYUV420PackedSemiPlanar:
{
@@ -70,6 +71,7 @@ SoftwareRenderer::SoftwareRenderer(
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#endif
default:
halFormat = HAL_PIXEL_FORMAT_RGB_565;
diff --git a/opengl/include/GLES/glext.h b/opengl/include/GLES/glext.h
index 65ab5e4..05ac93e 100644
--- a/opengl/include/GLES/glext.h
+++ b/opengl/include/GLES/glext.h
@@ -213,7 +213,11 @@ typedef void* GLeglImageOES;
/* GL_OES_EGL_image_external */
#ifndef GL_OES_EGL_image_external
+#ifdef MISSING_EGL_EXTERNAL_IMAGE
+#define GL_TEXTURE_EXTERNAL_OES 0x0DE1
+#else
#define GL_TEXTURE_EXTERNAL_OES 0x8D65
+#endif
#define GL_SAMPLER_EXTERNAL_OES 0x8D66
#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
diff --git a/opengl/include/GLES2/gl2ext.h b/opengl/include/GLES2/gl2ext.h
index 9db4e25..8135f4a 100644
--- a/opengl/include/GLES2/gl2ext.h
+++ b/opengl/include/GLES2/gl2ext.h
@@ -148,7 +148,11 @@ typedef void* GLeglImageOES;
/* GL_OES_EGL_image_external */
#ifndef GL_OES_EGL_image_external
+#ifdef MISSING_EGL_EXTERNAL_IMAGE
+#define GL_TEXTURE_EXTERNAL_OES 0x0DE1
+#else
#define GL_TEXTURE_EXTERNAL_OES 0x8D65
+#endif
#define GL_SAMPLER_EXTERNAL_OES 0x8D66
#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
diff --git a/opengl/libagl/Android.mk b/opengl/libagl/Android.mk
index 15e58f2..ce55093 100644
--- a/opengl/libagl/Android.mk
+++ b/opengl/libagl/Android.mk
@@ -44,6 +44,9 @@ endif
ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true)
LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
endif
+ifeq ($(TARGET_HAVE_TEGRA_ERRATA_657451),true)
+ LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
+endif
LOCAL_C_INCLUDES += bionic/libc/private
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
diff --git a/opengl/libagl/state.cpp b/opengl/libagl/state.cpp
index 90e9612..7321182 100644
--- a/opengl/libagl/state.cpp
+++ b/opengl/libagl/state.cpp
@@ -191,9 +191,11 @@ static void enable_disable(ogles_context_t* c, GLenum cap, int enabled)
// these need to fall through into the rasterizer
c->rasterizer.procs.enableDisable(c, cap, enabled);
break;
+#ifndef MISSING_EGL_EXTERNAL_IMAGE
case GL_TEXTURE_EXTERNAL_OES:
c->rasterizer.procs.enableDisable(c, GL_TEXTURE_2D, enabled);
break;
+#endif
case GL_MULTISAMPLE:
case GL_SAMPLE_ALPHA_TO_COVERAGE:
diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk
index 9c1a10e..993e379 100644
--- a/opengl/libs/Android.mk
+++ b/opengl/libs/Android.mk
@@ -29,6 +29,9 @@ ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
endif
# we need to access the private Bionic header <bionic_tls.h>
+ifeq ($(TARGET_HAVE_TEGRA_ERRATA_657451),true)
+ LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
+endif
LOCAL_C_INCLUDES += bionic/libc/private
LOCAL_CFLAGS += -DLOG_TAG=\"libEGL\"
@@ -43,6 +46,9 @@ endif
ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
endif
+ifeq ($(TARGET_HAVE_TEGRA_ERRATA_657451),true)
+ LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
+endif
ifneq ($(MAX_EGL_CACHE_ENTRY_SIZE),)
LOCAL_CFLAGS += -DMAX_EGL_CACHE_ENTRY_SIZE=$(MAX_EGL_CACHE_ENTRY_SIZE)
@@ -90,6 +96,9 @@ LOCAL_SHARED_LIBRARIES += libdl
ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
endif
+ifeq ($(TARGET_HAVE_TEGRA_ERRATA_657451),true)
+ LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
+endif
LOCAL_C_INCLUDES += bionic/libc/private
LOCAL_CFLAGS += -DLOG_TAG=\"libGLESv1\"
@@ -99,6 +108,9 @@ LOCAL_CFLAGS += -fvisibility=hidden
ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
endif
+ifeq ($(TARGET_HAVE_TEGRA_ERRATA_657451),true)
+ LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
+endif
include $(BUILD_SHARED_LIBRARY)
@@ -122,6 +134,9 @@ LOCAL_SHARED_LIBRARIES += libdl
ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
endif
+ifeq ($(TARGET_HAVE_TEGRA_ERRATA_657451),true)
+ LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
+endif
LOCAL_C_INCLUDES += bionic/libc/private
LOCAL_CFLAGS += -DLOG_TAG=\"libGLESv2\"
@@ -131,6 +146,9 @@ LOCAL_CFLAGS += -fvisibility=hidden
ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
endif
+ifeq ($(TARGET_HAVE_TEGRA_ERRATA_657451),true)
+ LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
+endif
include $(BUILD_SHARED_LIBRARY)
diff --git a/opengl/libs/GLES2/gl2.cpp b/opengl/libs/GLES2/gl2.cpp
index fee4609..27ec907 100644
--- a/opengl/libs/GLES2/gl2.cpp
+++ b/opengl/libs/GLES2/gl2.cpp
@@ -43,9 +43,18 @@ using namespace android;
#if USE_FAST_TLS_KEY
+ #ifdef HAVE_TEGRA_ERRATA_657451
+ #define MUNGE_TLS(_tls) \
+ "bfi " #_tls ", " #_tls ", #20, #1 \n" \
+ "bic " #_tls ", " #_tls ", #1 \n"
+ #else
+ #define MUNGE_TLS(_tls) "\n"
+ #endif
+
#ifdef HAVE_ARM_TLS_REGISTER
#define GET_TLS(reg) \
- "mrc p15, 0, " #reg ", c13, c0, 3 \n"
+ "mrc p15, 0, " #reg ", c13, c0, 3 \n" \
+ MUNGE_TLS(reg)
#else
#define GET_TLS(reg) \
"mov " #reg ", #0xFFFF0FFF \n" \
diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp
index ee29f12..b62515b 100644
--- a/opengl/libs/GLES_CM/gl.cpp
+++ b/opengl/libs/GLES_CM/gl.cpp
@@ -97,9 +97,18 @@ GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
#if USE_FAST_TLS_KEY && !CHECK_FOR_GL_ERRORS
+ #ifdef HAVE_TEGRA_ERRATA_657451
+ #define MUNGE_TLS(_tls) \
+ "bfi " #_tls ", " #_tls ", #20, #1 \n" \
+ "bic " #_tls ", " #_tls ", #1 \n"
+ #else
+ #define MUNGE_TLS(_tls) "\n"
+ #endif
+
#ifdef HAVE_ARM_TLS_REGISTER
#define GET_TLS(reg) \
- "mrc p15, 0, " #reg ", c13, c0, 3 \n"
+ "mrc p15, 0, " #reg ", c13, c0, 3 \n" \
+ MUNGE_TLS(reg)
#else
#define GET_TLS(reg) \
"mov " #reg ", #0xFFFF0FFF \n" \
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
index 135a04c..fcd57a3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
@@ -897,6 +897,8 @@ public class NetworkController extends BroadcastReceiver {
combinedActivityIconId = mMobileActivityIconId;
combinedSignalIconId = mDataSignalIconId; // set by updateDataIcon()
mContentDescriptionCombinedSignal = mContentDescriptionDataType;
+ } else {
+ mMobileActivityIconId = 0;
}
if (mWifiConnected) {
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
index 7dff549..8d53cd6 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
@@ -126,8 +126,9 @@ public class StorageNotification extends StorageEventListener {
}
private void onStorageStateChangedAsync(String path, String oldState, String newState) {
+ boolean isPrimary = Environment.getExternalStorageDirectory().getPath().equals(path);
Slog.i(TAG, String.format(
- "Media {%s} state changed from {%s} -> {%s}", path, oldState, newState));
+ "Media {%s} state changed from {%s} -> {%s} (primary = %b)", path, oldState, newState, isPrimary));
if (newState.equals(Environment.MEDIA_SHARED)) {
/*
* Storage is now shared. Modify the UMS notification
@@ -227,25 +228,25 @@ public class StorageNotification extends StorageEventListener {
} else if (newState.equals(Environment.MEDIA_REMOVED)) {
/*
* Storage has been removed. Show nomedia media notification,
- * and disable UMS notification regardless of connection state.
+ * and disable UMS notification if the removed storage is the primary storage.
*/
setMediaStorageNotification(
com.android.internal.R.string.ext_media_nomedia_notification_title,
com.android.internal.R.string.ext_media_nomedia_notification_message,
com.android.internal.R.drawable.stat_notify_sdcard_usb,
- true, false, null);
- updateUsbMassStorageNotification(false);
+ true, !isPrimary, null);
+ updateUsbMassStorageNotification(isPrimary ? false : mUmsAvailable);
} else if (newState.equals(Environment.MEDIA_BAD_REMOVAL)) {
/*
* Storage has been removed unsafely. Show bad removal media notification,
- * and disable UMS notification regardless of connection state.
+ * and disable UMS notification if the removed storage is the primary storage.
*/
setMediaStorageNotification(
com.android.internal.R.string.ext_media_badremoval_notification_title,
com.android.internal.R.string.ext_media_badremoval_notification_message,
com.android.internal.R.drawable.stat_sys_warning,
true, true, null);
- updateUsbMassStorageNotification(false);
+ updateUsbMassStorageNotification(isPrimary ? false : mUmsAvailable);
} else {
Slog.w(TAG, String.format("Ignoring unknown state {%s}", newState));
}
@@ -412,4 +413,5 @@ public class StorageNotification extends StorageEventListener {
notificationManager.cancel(notificationId);
}
}
+
}
diff --git a/policy/src/com/android/internal/policy/impl/GlobalActions.java b/policy/src/com/android/internal/policy/impl/GlobalActions.java
index 38c85bb..dfece30 100644
--- a/policy/src/com/android/internal/policy/impl/GlobalActions.java
+++ b/policy/src/com/android/internal/policy/impl/GlobalActions.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2011 David van Tonder
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,6 +49,16 @@ import com.google.android.collect.Lists;
import java.util.ArrayList;
/**
+ * Needed for takeScreenshot
+ */
+import android.content.ServiceConnection;
+import android.content.ComponentName;
+import android.os.IBinder;
+import android.os.Messenger;
+import android.os.RemoteException;
+
+
+/**
* Helper to show the global actions dialog. Each item is an {@link Action} that
* may show depending on whether the keyguard is showing, and whether the device
* is provisioned.
@@ -179,6 +190,38 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
}
});
+ // next: reboot
+ mItems.add(
+ new SinglePressAction(com.android.internal.R.drawable.ic_lock_reboot, R.string.global_action_reboot) {
+ public void onPress() {
+ ShutdownThread.reboot(mContext, "null", true);
+ }
+
+ public boolean showDuringKeyguard() {
+ return true;
+ }
+
+ public boolean showBeforeProvisioning() {
+ return true;
+ }
+ });
+
+ // next: screenshot
+ mItems.add(
+ new SinglePressAction(com.android.internal.R.drawable.ic_lock_screenshot, R.string.global_action_screenshot) {
+ public void onPress() {
+ takeScreenshot();
+ }
+
+ public boolean showDuringKeyguard() {
+ return true;
+ }
+
+ public boolean showBeforeProvisioning() {
+ return true;
+ }
+ });
+
// next: airplane mode
mItems.add(mAirplaneModeOn);
@@ -187,6 +230,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
mItems.add(mSilentModeAction);
}
+
mAdapter = new MyAdapter();
final AlertDialog.Builder ab = new AlertDialog.Builder(mContext);
@@ -203,6 +247,88 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
return dialog;
}
+ /**
+ * functions needed for taking screenhots.
+ * This leverages the built in ICS screenshot functionality
+ */
+ final Object mScreenshotLock = new Object();
+ ServiceConnection mScreenshotConnection = null;
+
+ final Runnable mScreenshotTimeout = new Runnable() {
+ @Override public void run() {
+ synchronized (mScreenshotLock) {
+ if (mScreenshotConnection != null) {
+ mContext.unbindService(mScreenshotConnection);
+ mScreenshotConnection = null;
+ }
+ }
+ }
+ };
+
+ private void takeScreenshot() {
+ synchronized (mScreenshotLock) {
+ if (mScreenshotConnection != null) {
+ return;
+ }
+ ComponentName cn = new ComponentName("com.android.systemui",
+ "com.android.systemui.screenshot.TakeScreenshotService");
+ Intent intent = new Intent();
+ intent.setComponent(cn);
+ ServiceConnection conn = new ServiceConnection() {
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ synchronized (mScreenshotLock) {
+ if (mScreenshotConnection != this) {
+ return;
+ }
+ Messenger messenger = new Messenger(service);
+ Message msg = Message.obtain(null, 1);
+ final ServiceConnection myConn = this;
+ Handler h = new Handler(mHandler.getLooper()) {
+ @Override
+ public void handleMessage(Message msg) {
+ synchronized (mScreenshotLock) {
+ if (mScreenshotConnection == myConn) {
+ mContext.unbindService(mScreenshotConnection);
+ mScreenshotConnection = null;
+ mHandler.removeCallbacks(mScreenshotTimeout);
+ }
+ }
+ }
+ };
+ msg.replyTo = new Messenger(h);
+ msg.arg1 = msg.arg2 = 0;
+
+ /* remove for the time being
+ if (mStatusBar != null && mStatusBar.isVisibleLw())
+ msg.arg1 = 1;
+ if (mNavigationBar != null && mNavigationBar.isVisibleLw())
+ msg.arg2 = 1;
+ */
+
+ /* wait for the dislog box to close */
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ie) {
+ }
+
+ /* take the screenshot */
+ try {
+ messenger.send(msg);
+ } catch (RemoteException e) {
+ }
+ }
+ }
+ @Override
+ public void onServiceDisconnected(ComponentName name) {}
+ };
+ if (mContext.bindService(intent, conn, Context.BIND_AUTO_CREATE)) {
+ mScreenshotConnection = conn;
+ mHandler.postDelayed(mScreenshotTimeout, 10000);
+ }
+ }
+ }
+
private void prepareDialog() {
final boolean silentModeOn =
mAudioManager.getRingerMode() != AudioManager.RINGER_MODE_NORMAL;
@@ -213,6 +339,9 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
} else {
mDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);
}
+
+ mDialog.setTitle(R.string.global_actions);
+
if (SHOW_SILENT_TOGGLE) {
IntentFilter filter = new IntentFilter(AudioManager.RINGER_MODE_CHANGED_ACTION);
mContext.registerReceiver(mRingerModeReceiver, filter);
diff --git a/services/input/Android.mk b/services/input/Android.mk
index 86c6c8a..85dddb8 100644
--- a/services/input/Android.mk
+++ b/services/input/Android.mk
@@ -39,6 +39,10 @@ LOCAL_SHARED_LIBRARIES := \
LOCAL_C_INCLUDES := \
external/skia/include/core
+ifeq ($(BOARD_USE_LEGACY_TOUCHSCREEN),true)
+LOCAL_CFLAGS += -DLEGACY_TOUCHSCREEN
+endif
+
LOCAL_MODULE:= libinput
LOCAL_MODULE_TAGS := optional
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index b34ff25..408b805 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -931,6 +931,9 @@ void InputDevice::process(const RawEvent* rawEvents, size_t count) {
// have side-effects that must be interleaved. For example, joystick movement events and
// gamepad button presses are handled by different mappers but they should be dispatched
// in the order received.
+#ifdef LEGACY_TOUCHSCREEN
+ static int32_t touched, z_data;
+#endif
size_t numMappers = mMappers.size();
for (const RawEvent* rawEvent = rawEvents; count--; rawEvent++) {
#if DEBUG_RAW_EVENTS
@@ -956,9 +959,62 @@ void InputDevice::process(const RawEvent* rawEvents, size_t count) {
mDropUntilNextSync = true;
reset(rawEvent->when);
} else {
- for (size_t i = 0; i < numMappers; i++) {
- InputMapper* mapper = mMappers[i];
- mapper->process(rawEvent);
+
+ if (!numMappers) continue;
+ InputMapper* mapper = NULL;
+
+#ifdef LEGACY_TOUCHSCREEN
+
+ // Old touchscreen sensors need to send a fake BTN_TOUCH (BTN_LEFT)
+
+ if (rawEvent->scanCode == ABS_MT_TOUCH_MAJOR) {
+
+ z_data = rawEvent->value;
+ touched = (0 != z_data);
+ }
+ else if (rawEvent->scanCode == ABS_MT_POSITION_Y) {
+
+ RawEvent event;
+ memset(&event, 0, sizeof(event));
+ event.when = rawEvent->when;
+ event.deviceId = rawEvent->deviceId;
+ event.scanCode = rawEvent->scanCode;
+
+ event.type = rawEvent->type;
+ event.value = rawEvent->value;
+ for (size_t i = 0; i < numMappers; i++) {
+ mapper = mMappers[i];
+ mapper->process(&event);
+ }
+
+ /* Pressure on contact area from ABS_MT_TOUCH_MAJOR */
+ event.type = rawEvent->type;
+ event.scanCode = ABS_MT_PRESSURE;
+ event.value = z_data;
+ for (size_t i = 0; i < numMappers; i++) {
+ mapper = mMappers[i];
+ mapper->process(&event);
+ }
+
+ event.type = EV_KEY;
+ event.scanCode = BTN_TOUCH;
+ event.keyCode = BTN_LEFT;
+ event.value = touched;
+ for (size_t i = 0; i < numMappers; i++) {
+ mapper = mMappers[i];
+ mapper->process(&event);
+ }
+
+ LOGD("Fake event sent, touch=%d !", touched);
+ }
+ else
+#endif //LEGACY_TOUCHSCREEN
+ {
+ // just send the rawEvent
+ for (size_t i = 0; i < numMappers; i++) {
+ mapper = mMappers[i];
+ mapper->process(rawEvent);
+ }
}
}
}
diff --git a/services/java/com/android/server/DeviceStorageMonitorService.java b/services/java/com/android/server/DeviceStorageMonitorService.java
index 16eeb7b..868f50a 100644
--- a/services/java/com/android/server/DeviceStorageMonitorService.java
+++ b/services/java/com/android/server/DeviceStorageMonitorService.java
@@ -68,18 +68,18 @@ public class DeviceStorageMonitorService extends Binder {
private static final long DEFAULT_DISK_FREE_CHANGE_REPORTING_THRESHOLD = 2 * 1024 * 1024; // 2MB
private static final long DEFAULT_CHECK_INTERVAL = MONITOR_INTERVAL*60*1000;
private static final int DEFAULT_FULL_THRESHOLD_BYTES = 1024*1024; // 1MB
- private long mFreeMem; // on /data
+ private long mFreeMem; // on /data/data
private long mLastReportedFreeMem;
private long mLastReportedFreeMemTime;
private boolean mLowMemFlag=false;
private boolean mMemFullFlag=false;
private Context mContext;
private ContentResolver mContentResolver;
- private long mTotalMemory; // on /data
+ private long mTotalMemory; // on /data/data
private StatFs mDataFileStats;
private StatFs mSystemFileStats;
private StatFs mCacheFileStats;
- private static final String DATA_PATH = "/data";
+ private static final String DATA_PATH = "/data/data"; // might not be the same fs as /data
private static final String SYSTEM_PATH = "/system";
private static final String CACHE_PATH = "/cache";
private long mThreadStartTime = -1;
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index 5425813..7e589c6 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -369,6 +369,13 @@ class MountService extends IMountService.Stub
case H_UNMOUNT_PM_UPDATE: {
if (DEBUG_UNMOUNT) Slog.i(TAG, "H_UNMOUNT_PM_UPDATE");
UnmountCallBack ucb = (UnmountCallBack) msg.obj;
+ if (!mUpdatingStatus && !isExternalStorage(ucb.path)) {
+ // If PM isn't already updating, and this isn't an ASEC
+ // mount, then go ahead and do the unmount immediately.
+ if (DEBUG_UNMOUNT) Slog.i(TAG, " skipping PackageManager for " + ucb.path);
+ ucb.handleFinished();
+ break;
+ }
mForceUnmounts.add(ucb);
if (DEBUG_UNMOUNT) Slog.i(TAG, " registered = " + mUpdatingStatus);
// Register only if needed.
@@ -588,7 +595,9 @@ class MountService extends IMountService.Stub
// Update state on PackageManager, but only of real events
if (!mEmulateExternalStorage) {
if (Environment.MEDIA_UNMOUNTED.equals(state)) {
- mPms.updateExternalMediaStatus(false, false);
+ if (isExternalStorage(path)) {
+ mPms.updateExternalMediaStatus(false, false);
+ }
/*
* Some OBBs might have been unmounted when this volume was
@@ -598,7 +607,9 @@ class MountService extends IMountService.Stub
mObbActionHandler.sendMessage(mObbActionHandler.obtainMessage(
OBB_FLUSH_MOUNT_STATE, path));
} else if (Environment.MEDIA_MOUNTED.equals(state)) {
- mPms.updateExternalMediaStatus(true, false);
+ if (isExternalStorage(path)) {
+ mPms.updateExternalMediaStatus(true, false);
+ }
}
}
}
@@ -907,7 +918,9 @@ class MountService extends IMountService.Stub
Runtime.getRuntime().gc();
// Redundant probably. But no harm in updating state again.
- mPms.updateExternalMediaStatus(false, false);
+ if (isExternalStorage(path)) {
+ mPms.updateExternalMediaStatus(false, false);
+ }
try {
String arg = removeEncryption
? " force_and_revert"
@@ -1007,8 +1020,13 @@ class MountService extends IMountService.Stub
mSendUmsConnectedOnBoot = avail;
}
- final String path = Environment.getExternalStorageDirectory().getPath();
- if (avail == false && getVolumeState(path).equals(Environment.MEDIA_SHARED)) {
+ final ArrayList<String> volumes = getShareableVolumes();
+ boolean mediaShared = false;
+ for (String path : volumes) {
+ if (getVolumeState(path).equals(Environment.MEDIA_SHARED))
+ mediaShared = true;
+ }
+ if (avail == false && mediaShared) {
/*
* USB mass storage disconnected while enabled
*/
@@ -1018,11 +1036,15 @@ class MountService extends IMountService.Stub
try {
int rc;
Slog.w(TAG, "Disabling UMS after cable disconnect");
- doShareUnshareVolume(path, "ums", false);
- if ((rc = doMountVolume(path)) != StorageResultCode.OperationSucceeded) {
- Slog.e(TAG, String.format(
- "Failed to remount {%s} on UMS enabled-disconnect (%d)",
- path, rc));
+ for (String path : volumes) {
+ if (getVolumeState(path).equals(Environment.MEDIA_SHARED)) {
+ doShareUnshareVolume(path, "ums", false);
+ if ((rc = doMountVolume(path)) != StorageResultCode.OperationSucceeded) {
+ Slog.e(TAG, String.format(
+ "Failed to remount {%s} on UMS enabled-disconnect (%d)",
+ path, rc));
+ }
+ }
}
} catch (Exception ex) {
Slog.w(TAG, "Failed to mount media on UMS enabled-disconnect", ex);
@@ -1305,46 +1327,68 @@ class MountService extends IMountService.Stub
}
}
+ private boolean isExternalStorage(String path) {
+ return Environment.getExternalStorageDirectory().getPath().equals(path);
+ }
+
+ private ArrayList<String> getShareableVolumes() {
+ // Sharable volumes have android:allowMassStorage="true" in storage_list.xml
+ ArrayList<String> volumesToMount = new ArrayList<String>();
+ synchronized (mVolumes) {
+ for (StorageVolume v : mVolumes) {
+ if (v.allowMassStorage()) {
+ volumesToMount.add(v.getPath());
+ }
+ }
+ }
+ return volumesToMount;
+ }
+
public void setUsbMassStorageEnabled(boolean enable) {
waitForReady();
validatePermission(android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS);
// TODO: Add support for multiple share methods
-
- /*
- * If the volume is mounted and we're enabling then unmount it
- */
- String path = Environment.getExternalStorageDirectory().getPath();
- String vs = getVolumeState(path);
- String method = "ums";
- if (enable && vs.equals(Environment.MEDIA_MOUNTED)) {
- // Override for isUsbMassStorageEnabled()
- setUmsEnabling(enable);
- UmsEnableCallBack umscb = new UmsEnableCallBack(path, method, true);
- mHandler.sendMessage(mHandler.obtainMessage(H_UNMOUNT_PM_UPDATE, umscb));
- // Clear override
- setUmsEnabling(false);
- }
- /*
- * If we disabled UMS then mount the volume
- */
- if (!enable) {
- doShareUnshareVolume(path, method, enable);
- if (doMountVolume(path) != StorageResultCode.OperationSucceeded) {
- Slog.e(TAG, "Failed to remount " + path +
- " after disabling share method " + method);
- /*
- * Even though the mount failed, the unshare didn't so don't indicate an error.
- * The mountVolume() call will have set the storage state and sent the necessary
- * broadcasts.
- */
+ for (String path : getShareableVolumes()) {
+ /*
+ * If the volume is mounted and we're enabling then unmount it
+ */
+ String vs = getVolumeState(path);
+ String method = "ums";
+ if (enable && vs.equals(Environment.MEDIA_MOUNTED)) {
+ // Override for isUsbMassStorageEnabled()
+ setUmsEnabling(enable);
+ UmsEnableCallBack umscb = new UmsEnableCallBack(path, method, true);
+ mHandler.sendMessage(mHandler.obtainMessage(H_UNMOUNT_PM_UPDATE, umscb));
+ // Clear override
+ setUmsEnabling(false);
+ }
+ /*
+ * If we disabled UMS then mount the volume
+ */
+ if (!enable) {
+ doShareUnshareVolume(path, method, enable);
+ if (doMountVolume(path) != StorageResultCode.OperationSucceeded) {
+ Slog.e(TAG, "Failed to remount " + path +
+ " after disabling share method " + method);
+ /*
+ * Even though the mount failed, the unshare didn't so don't indicate an error.
+ * The mountVolume() call will have set the storage state and sent the necessary
+ * broadcasts.
+ */
+ }
}
}
}
public boolean isUsbMassStorageEnabled() {
waitForReady();
- return doGetVolumeShared(Environment.getExternalStorageDirectory().getPath(), "ums");
+ for (String path : getShareableVolumes()) {
+ if (doGetVolumeShared(path, "ums"))
+ return true;
+ }
+ // no volume is shared
+ return false;
}
/**
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index 6b61c47..0eeb377 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -3187,6 +3187,20 @@ public class PackageManagerService extends IPackageManager.Stub {
return null;
}
+ if (!pkg.applicationInfo.sourceDir.startsWith(Environment.getRootDirectory().getPath()) &&
+ !pkg.applicationInfo.sourceDir.startsWith("/vendor")) {
+ Object obj = mSettings.getUserIdLPr(1000);
+ Signature[] s1 = null;
+ if (obj instanceof SharedUserSetting) {
+ s1 = ((SharedUserSetting)obj).signatures.mSignatures;
+ }
+ if ((compareSignatures(pkg.mSignatures, s1) == PackageManager.SIGNATURE_MATCH)) {
+ Slog.w(TAG, "Cannot install platform packages to user storage");
+ mLastScanError = PackageManager.INSTALL_FAILED_INVALID_INSTALL_LOCATION;
+ return null;
+ }
+ }
+
// Initialize package source and resource directories
File destCodeFile = new File(pkg.applicationInfo.sourceDir);
File destResourceFile = new File(pkg.applicationInfo.publicSourceDir);
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index f5c2de9..669fdbb 100644..100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -6084,7 +6084,7 @@ public class WindowManagerService extends IWindowManager.Stub
config.compatSmallestScreenWidthDp = computeCompatSmallestWidth(rotated, dm, dw, dh);
// Determine whether a hard keyboard is available and enabled.
- boolean hardKeyboardAvailable = config.keyboard != Configuration.KEYBOARD_NOKEYS;
+ boolean hardKeyboardAvailable = config.keyboard == Configuration.KEYBOARD_NOKEYS;
if (hardKeyboardAvailable != mHardKeyboardAvailable) {
mHardKeyboardAvailable = hardKeyboardAvailable;
mHardKeyboardEnabled = hardKeyboardAvailable;
diff --git a/services/sensorservice/Android.mk b/services/sensorservice/Android.mk
index 6a302c0..792ee28 100644
--- a/services/sensorservice/Android.mk
+++ b/services/sensorservice/Android.mk
@@ -16,6 +16,29 @@ LOCAL_SRC_FILES:= \
LOCAL_CFLAGS:= -DLOG_TAG=\"SensorService\"
+ifeq ($(TARGET_USES_OLD_LIBSENSORS_HAL),true)
+ LOCAL_CFLAGS += -DENABLE_SENSORS_COMPAT
+endif
+
+ifeq ($(TARGET_SENSORS_NO_OPEN_CHECK),true)
+ LOCAL_CFLAGS += -DSENSORS_NO_OPEN_CHECK
+endif
+
+ifeq ($(TARGET_HAS_FOXCONN_SENSORS),true)
+ LOCAL_CFLAGS += -DFOXCONN_SENSORS
+endif
+
+ifneq ($(TARGET_PROXIMITY_SENSOR_LIMIT),)
+ LOCAL_CFLAGS += -DPROXIMITY_LIES=$(TARGET_PROXIMITY_SENSOR_LIMIT)
+endif
+
+ifneq ($(filter p990 p999 p970, $(TARGET_BOOTLOADER_BOARD_NAME)),)
+ LOCAL_CFLAGS += -DUSE_LGE_ALS_DUMMY
+ ifeq ($(TARGET_BOOTLOADER_BOARD_NAME),p970)
+ LOCAL_CFLAGS += -DUSE_LGE_ALS_OMAP3
+ endif
+endif
+
LOCAL_SHARED_LIBRARIES := \
libcutils \
libhardware \
diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp
index 7575ebd..0a19d53 100644
--- a/services/sensorservice/SensorDevice.cpp
+++ b/services/sensorservice/SensorDevice.cpp
@@ -31,6 +31,11 @@
#include "SensorDevice.h"
#include "SensorService.h"
+#include "sensors_deprecated.h"
+#ifdef USE_LGE_ALS_DUMMY
+#include <fcntl.h>
+#endif
+
namespace android {
// ---------------------------------------------------------------------------
class BatteryService : public Singleton<BatteryService> {
@@ -98,8 +103,31 @@ ANDROID_SINGLETON_STATIC_INSTANCE(BatteryService)
ANDROID_SINGLETON_STATIC_INSTANCE(SensorDevice)
+#ifdef USE_LGE_ALS_DUMMY
+static ssize_t addDummyLGESensor(sensor_t const **list, ssize_t count) {
+ struct sensor_t dummy_light = {
+ name : "Dummy LGE-Star light sensor",
+ vendor : "CyanogenMod",
+ version : 1,
+ handle : SENSOR_TYPE_LIGHT,
+ type : SENSOR_TYPE_LIGHT,
+ maxRange : 20,
+ resolution : 0.1,
+ power : 20,
+ };
+ void * new_list = malloc((count+1)*sizeof(sensor_t));
+ new_list = memcpy(new_list, *list, count*sizeof(sensor_t));
+ ((sensor_t *)new_list)[count] = dummy_light;
+ *list = (sensor_t const *)new_list;
+ count++;
+ return count;
+}
+#endif
+
SensorDevice::SensorDevice()
: mSensorDevice(0),
+ mOldSensorsEnabled(0),
+ mOldSensorsCompatMode(false),
mSensorModule(0)
{
status_t err = hw_get_module(SENSORS_HARDWARE_MODULE_ID,
@@ -109,19 +137,56 @@ SensorDevice::SensorDevice()
SENSORS_HARDWARE_MODULE_ID, strerror(-err));
if (mSensorModule) {
+#ifdef ENABLE_SENSORS_COMPAT
+#ifdef SENSORS_NO_OPEN_CHECK
+ sensors_control_open(&mSensorModule->common, &mSensorControlDevice) ;
+ sensors_data_open(&mSensorModule->common, &mSensorDataDevice) ;
+ mOldSensorsCompatMode = true;
+#else
+ if (!sensors_control_open(&mSensorModule->common, &mSensorControlDevice)) {
+ if (sensors_data_open(&mSensorModule->common, &mSensorDataDevice)) {
+ LOGE("couldn't open data device in backwards-compat mode for module %s (%s)",
+ SENSORS_HARDWARE_MODULE_ID, strerror(-err));
+ } else {
+ LOGD("Opened sensors in backwards compat mode");
+ mOldSensorsCompatMode = true;
+ }
+ } else {
+ LOGE("couldn't open control device in backwards-compat mode for module %s (%s)",
+ SENSORS_HARDWARE_MODULE_ID, strerror(-err));
+ }
+#endif
+#else
err = sensors_open(&mSensorModule->common, &mSensorDevice);
-
LOGE_IF(err, "couldn't open device for module %s (%s)",
SENSORS_HARDWARE_MODULE_ID, strerror(-err));
+#endif
+
- if (mSensorDevice) {
+ if (mSensorDevice || mOldSensorsCompatMode) {
sensor_t const* list;
ssize_t count = mSensorModule->get_sensors_list(mSensorModule, &list);
+
+#ifdef USE_LGE_ALS_DUMMY
+ count = addDummyLGESensor(&list, count);
+#endif
+
+ if (mOldSensorsCompatMode) {
+ mOldSensorsList = list;
+ mOldSensorsCount = count;
+ mSensorDataDevice->data_open(mSensorDataDevice,
+ mSensorControlDevice->open_data_source(mSensorControlDevice));
+ }
+
mActivationCount.setCapacity(count);
Info model;
for (size_t i=0 ; i<size_t(count) ; i++) {
mActivationCount.add(list[i].handle, model);
- mSensorDevice->activate(mSensorDevice, list[i].handle, 0);
+ if (mOldSensorsCompatMode) {
+ mSensorControlDevice->activate(mSensorControlDevice, list[i].handle, 0);
+ } else {
+ mSensorDevice->activate(mSensorDevice, list[i].handle, 0);
+ }
}
}
}
@@ -157,28 +222,134 @@ void SensorDevice::dump(String8& result, char* buffer, size_t SIZE)
ssize_t SensorDevice::getSensorList(sensor_t const** list) {
if (!mSensorModule) return NO_INIT;
ssize_t count = mSensorModule->get_sensors_list(mSensorModule, list);
+
+#ifdef USE_LGE_ALS_DUMMY
+ return addDummyLGESensor(list, count);
+#endif
return count;
}
status_t SensorDevice::initCheck() const {
- return mSensorDevice && mSensorModule ? NO_ERROR : NO_INIT;
+ return (mSensorDevice || mOldSensorsCompatMode) && mSensorModule ? NO_ERROR : NO_INIT;
}
ssize_t SensorDevice::poll(sensors_event_t* buffer, size_t count) {
- if (!mSensorDevice) return NO_INIT;
ssize_t c;
- do {
- c = mSensorDevice->poll(mSensorDevice, buffer, count);
- } while (c == -EINTR);
- return c;
+ if (!mSensorDevice && !mOldSensorsCompatMode) return NO_INIT;
+ if (mOldSensorsCompatMode) {
+ size_t pollsDone = 0;
+ //LOGV("%d buffers were requested",count);
+ while (!mOldSensorsEnabled) {
+ sleep(1);
+ LOGV("Waiting...");
+ }
+ while (pollsDone < (size_t)mOldSensorsEnabled && pollsDone < count) {
+ sensors_data_t oldBuffer;
+ long result = mSensorDataDevice->poll(mSensorDataDevice, &oldBuffer);
+ int sensorType = -1;
+ int maxRange = -1;
+
+ if (result == 0x7FFFFFFF) {
+ continue;
+ } else {
+ /* the old data_poll is supposed to return a handle,
+ * which has to be mapped to the type. */
+ for (size_t i=0 ; i<size_t(mOldSensorsCount) && sensorType < 0 ; i++) {
+ if (mOldSensorsList[i].handle == result) {
+ sensorType = mOldSensorsList[i].type;
+ maxRange = mOldSensorsList[i].maxRange;
+ LOGV("mapped sensor type to %d",sensorType);
+ }
+ }
+ }
+ if ( sensorType <= 0 ||
+ sensorType > SENSOR_TYPE_ROTATION_VECTOR) {
+ LOGV("Useless output at round %u from %d",pollsDone, oldBuffer.sensor);
+ count--;
+ continue;
+ }
+ buffer[pollsDone].version = sizeof(struct sensors_event_t);
+ buffer[pollsDone].timestamp = oldBuffer.time;
+ buffer[pollsDone].type = sensorType;
+ buffer[pollsDone].sensor = result;
+ /* This part is a union. Regardless of the sensor type,
+ * we only need to copy a sensors_vec_t and a float */
+ buffer[pollsDone].acceleration = oldBuffer.vector;
+ buffer[pollsDone].temperature = oldBuffer.temperature;
+ LOGV("Adding results for sensor %d", buffer[pollsDone].sensor);
+ /* The ALS and PS sensors only report values on change,
+ * instead of a data "stream" like the others. So don't wait
+ * for the number of requested samples to fill, and deliver
+ * it immediately */
+ if (sensorType == SENSOR_TYPE_PROXIMITY) {
+#ifdef FOXCONN_SENSORS
+ /* Fix ridiculous API breakages from FIH. */
+ /* These idiots are returning -1 for FAR, and 1 for NEAR */
+ if (buffer[pollsDone].distance > 0) {
+ buffer[pollsDone].distance = 0;
+ } else {
+ buffer[pollsDone].distance = 1;
+ }
+#elif defined(PROXIMITY_LIES)
+ if (buffer[pollsDone].distance >= PROXIMITY_LIES)
+ buffer[pollsDone].distance = maxRange;
+#endif
+ return pollsDone+1;
+ } else if (sensorType == SENSOR_TYPE_LIGHT) {
+ return pollsDone+1;
+ }
+ pollsDone++;
+ }
+ return pollsDone;
+ } else {
+ do {
+ c = mSensorDevice->poll(mSensorDevice, buffer, count);
+ } while (c == -EINTR);
+ return c;
+ }
}
status_t SensorDevice::activate(void* ident, int handle, int enabled)
{
- if (!mSensorDevice) return NO_INIT;
+ if (!mSensorDevice && !mOldSensorsCompatMode) return NO_INIT;
status_t err(NO_ERROR);
bool actuateHardware = false;
+#ifdef USE_LGE_ALS_DUMMY
+
+ if (handle == SENSOR_TYPE_LIGHT) {
+ int nwr, ret, fd;
+ char value[2];
+
+#ifdef USE_LGE_ALS_OMAP3
+ fd = open("/sys/class/leds/lcd-backlight/als", O_RDWR);
+ if(fd < 0)
+ return -ENODEV;
+
+ nwr = sprintf(value, "%s\n", enabled ? "1" : "0");
+ write(fd, value, nwr);
+ close(fd);
+#else
+ fd = open("/sys/devices/platform/star_aat2870.0/lsensor_onoff", O_RDWR);
+ if(fd < 0)
+ return -ENODEV;
+
+ nwr = sprintf(value, "%s\n", enabled ? "1" : "0");
+ write(fd, value, nwr);
+ close(fd);
+ fd = open("/sys/devices/platform/star_aat2870.0/alc", O_RDWR);
+ if(fd < 0)
+ return -ENODEV;
+
+ nwr = sprintf(value, "%s\n", enabled ? "2" : "0");
+ write(fd, value, nwr);
+ close(fd);
+#endif
+
+ return 0;
+
+ }
+#endif
Info& info( mActivationCount.editValueFor(handle) );
@@ -217,7 +388,20 @@ status_t SensorDevice::activate(void* ident, int handle, int enabled)
if (actuateHardware) {
LOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w");
- err = mSensorDevice->activate(mSensorDevice, handle, enabled);
+ if (mOldSensorsCompatMode) {
+ if (enabled)
+ mOldSensorsEnabled++;
+ else if (mOldSensorsEnabled > 0)
+ mOldSensorsEnabled--;
+ LOGV("Activation for %d (%d)",handle,enabled);
+ if (enabled) {
+ mSensorControlDevice->wake(mSensorControlDevice);
+ }
+ err = mSensorControlDevice->activate(mSensorControlDevice, handle, enabled);
+ err = 0;
+ } else {
+ err = mSensorDevice->activate(mSensorDevice, handle, enabled);
+ }
if (enabled) {
LOGE_IF(err, "Error activating sensor %d (%s)", handle, strerror(-err));
if (err == 0) {
@@ -233,7 +417,11 @@ status_t SensorDevice::activate(void* ident, int handle, int enabled)
{ // scope for the lock
Mutex::Autolock _l(mLock);
nsecs_t ns = info.selectDelay();
- mSensorDevice->setDelay(mSensorDevice, handle, ns);
+ if (mOldSensorsCompatMode) {
+ mSensorControlDevice->set_delay(mSensorControlDevice, (ns/(1000*1000)));
+ } else {
+ mSensorDevice->setDelay(mSensorDevice, handle, ns);
+ }
}
return err;
@@ -241,13 +429,17 @@ status_t SensorDevice::activate(void* ident, int handle, int enabled)
status_t SensorDevice::setDelay(void* ident, int handle, int64_t ns)
{
- if (!mSensorDevice) return NO_INIT;
+ if (!mSensorDevice && !mOldSensorsCompatMode) return NO_INIT;
Mutex::Autolock _l(mLock);
Info& info( mActivationCount.editValueFor(handle) );
status_t err = info.setDelayForIdent(ident, ns);
if (err < 0) return err;
ns = info.selectDelay();
- return mSensorDevice->setDelay(mSensorDevice, handle, ns);
+ if (mOldSensorsCompatMode) {
+ return mSensorControlDevice->set_delay(mSensorControlDevice, (ns/(1000*1000)));
+ } else {
+ return mSensorDevice->setDelay(mSensorDevice, handle, ns);
+ }
}
// ---------------------------------------------------------------------------
diff --git a/services/sensorservice/SensorDevice.h b/services/sensorservice/SensorDevice.h
index 728b6cb..919edf9 100644
--- a/services/sensorservice/SensorDevice.h
+++ b/services/sensorservice/SensorDevice.h
@@ -36,6 +36,13 @@ static const nsecs_t DEFAULT_EVENTS_PERIOD = 200000000; // 5 Hz
class SensorDevice : public Singleton<SensorDevice> {
friend class Singleton<SensorDevice>;
struct sensors_poll_device_t* mSensorDevice;
+ struct sensors_data_device_t* mSensorDataDevice;
+ struct sensors_control_device_t* mSensorControlDevice;
+ int32_t mOldSensorsEnabled;
+ bool mOldSensorsCompatMode;
+ native_handle_t *mOldSensorsDataChannel;
+ sensor_t const* mOldSensorsList;
+ int mOldSensorsCount;
struct sensors_module_t* mSensorModule;
mutable Mutex mLock; // protect mActivationCount[].rates
// fixed-size array after construction
diff --git a/services/sensorservice/sensors_deprecated.h b/services/sensorservice/sensors_deprecated.h
new file mode 100644
index 0000000..efaf6ba
--- /dev/null
+++ b/services/sensorservice/sensors_deprecated.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define SENSORS_HARDWARE_CONTROL "control"
+#define SENSORS_HARDWARE_DATA "data"
+
+namespace android {
+
+typedef struct {
+ int sensor;
+ union {
+ sensors_vec_t vector;
+ sensors_vec_t orientation;
+ sensors_vec_t acceleration;
+ sensors_vec_t magnetic;
+ float temperature;
+ float distance;
+ float light;
+ };
+ int64_t time;
+ uint32_t reserved;
+} sensors_data_t;
+
+struct sensors_control_device_t {
+ struct hw_device_t common;
+ native_handle_t* (*open_data_source)(struct sensors_control_device_t *dev);
+ int (*close_data_source)(struct sensors_control_device_t *dev);
+ int (*activate)(struct sensors_control_device_t *dev,
+ int handle, int enabled);
+ int (*set_delay)(struct sensors_control_device_t *dev, int32_t ms);
+ int (*wake)(struct sensors_control_device_t *dev);
+};
+
+struct sensors_data_device_t {
+ struct hw_device_t common;
+ int (*data_open)(struct sensors_data_device_t *dev, native_handle_t* nh);
+ int (*data_close)(struct sensors_data_device_t *dev);
+ int (*poll)(struct sensors_data_device_t *dev,
+ sensors_data_t* data);
+};
+
+static inline int sensors_control_open(const struct hw_module_t* module,
+ struct sensors_control_device_t** device) {
+ return module->methods->open(module,
+ SENSORS_HARDWARE_CONTROL, (struct hw_device_t**)device);
+}
+
+static inline int sensors_control_close(struct sensors_control_device_t* device) {
+ return device->common.close(&device->common);
+}
+
+static inline int sensors_data_open(const struct hw_module_t* module,
+ struct sensors_data_device_t** device) {
+ return module->methods->open(module,
+ SENSORS_HARDWARE_DATA, (struct hw_device_t**)device);
+}
+
+static inline int sensors_data_close(struct sensors_data_device_t* device) {
+ return device->common.close(&device->common);
+}
+
+};
diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk
index f63c0c1..295ade9 100644
--- a/services/surfaceflinger/Android.mk
+++ b/services/surfaceflinger/Android.mk
@@ -45,6 +45,12 @@ LOCAL_SHARED_LIBRARIES := \
# this is only needed for DDMS debugging
LOCAL_SHARED_LIBRARIES += libdvm libandroid_runtime
+ifeq ($(BOARD_USES_LGE_HDMI_ROTATION),true)
+LOCAL_CFLAGS += -DUSE_LGE_HDMI
+LOCAL_SHARED_LIBRARIES += \
+ libnvdispmgr_d
+endif
+
LOCAL_C_INCLUDES := \
$(call include-path-for, corecg graphics)
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
index f94d321..ffe408c 100644
--- a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
+++ b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
@@ -184,8 +184,12 @@ void DisplayHardware::init(uint32_t dpy)
eglGetConfigs(display, NULL, 0, &numConfigs);
EGLConfig config = NULL;
+#ifdef FORCE_EGL_CONFIG
+ config = (EGLConfig)FORCE_EGL_CONFIG;
+#else
err = selectConfigForPixelFormat(display, attribs, format, &config);
LOGE_IF(err, "couldn't find an EGLConfig matching the screen format");
+#endif
EGLint r,g,b,a;
eglGetConfigAttrib(display, config, EGL_RED_SIZE, &r);
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index d3b0dbf..755b134 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -550,7 +550,12 @@ uint32_t Layer::getEffectiveUsage(uint32_t usage) const
// need a hardware-protected path to external video sink
usage |= GraphicBuffer::USAGE_PROTECTED;
}
+#ifdef MISSING_GRALLOC_BUFFERS
+ usage |= GraphicBuffer::USAGE_HW_TEXTURE;
+#else
usage |= GraphicBuffer::USAGE_HW_COMPOSER;
+#endif
+
return usage;
}
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 24bd2a6..945da43 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -69,6 +69,10 @@
#define DISPLAY_COUNT 1
+#ifdef USE_LGE_HDMI
+extern "C" void NvDispMgrAutoOrientation(int rotation);
+#endif
+
namespace android {
// ---------------------------------------------------------------------------
@@ -2621,6 +2625,9 @@ void GraphicPlane::setDisplayHardware(DisplayHardware *hw)
case 90:
displayOrientation = ISurfaceComposer::eOrientation90;
break;
+ case 180:
+ displayOrientation = ISurfaceComposer::eOrientation180;
+ break;
case 270:
displayOrientation = ISurfaceComposer::eOrientation270;
break;
@@ -2677,6 +2684,9 @@ status_t GraphicPlane::setOrientation(int orientation)
mWidth = int(w);
mHeight = int(h);
+#ifdef USE_LGE_HDMI
+ NvDispMgrAutoOrientation(orientation);
+#endif
Transform orientationTransform;
GraphicPlane::orientationToTransfrom(orientation, w, h,
&orientationTransform);
diff --git a/telephony/java/com/android/internal/telephony/DataCallState.java b/telephony/java/com/android/internal/telephony/DataCallState.java
index efbf608..a5a5965 100644
--- a/telephony/java/com/android/internal/telephony/DataCallState.java
+++ b/telephony/java/com/android/internal/telephony/DataCallState.java
@@ -81,7 +81,7 @@ public class DataCallState {
.append(" retry=").append(suggestedRetryTime)
.append(" cid=").append(cid)
.append(" active=").append(active)
- .append(" type=").append(type)
+ .append(" type='").append(type)
.append("' ifname='").append(ifname);
sb.append("' addresses=[");
for (String addr : addresses) {
diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java
index 94f7a13..d547802 100644
--- a/telephony/java/com/android/internal/telephony/PhoneBase.java
+++ b/telephony/java/com/android/internal/telephony/PhoneBase.java
@@ -1076,6 +1076,11 @@ public abstract class PhoneBase extends Handler implements Phone {
if (!mIsVoiceCapable)
return;
AsyncResult ar = new AsyncResult(null, cn, null);
+ if (SystemProperties.getBoolean(
+ "ro.telephony.call_ring.absent", true)) {
+ sendMessageDelayed(
+ obtainMessage(EVENT_CALL_RING_CONTINUE, mCallRingContinueToken, 0), mCallRingDelay);
+ }
mNewRingingConnectionRegistrants.notifyRegistrants(ar);
}
diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java
index f2e7f45..529724b 100644
--- a/telephony/java/com/android/internal/telephony/RIL.java
+++ b/telephony/java/com/android/internal/telephony/RIL.java
@@ -29,6 +29,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.LocalSocket;
import android.net.LocalSocketAddress;
@@ -196,7 +197,7 @@ class RILRequest {
*
* {@hide}
*/
-public final class RIL extends BaseCommands implements CommandsInterface {
+public class RIL extends BaseCommands implements CommandsInterface {
static final String LOG_TAG = "RILJ";
static final boolean RILJ_LOGD = true;
static final boolean RILJ_LOGV = false; // STOP SHIP if true
@@ -681,9 +682,13 @@ public final class RIL extends BaseCommands implements CommandsInterface {
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
- rr.mp.writeInt(2);
+ boolean oldRil = needsOldRilFeature("facilitylock");
+
+ rr.mp.writeInt(oldRil ? 1 : 2);
rr.mp.writeString(pin);
- rr.mp.writeString(aid);
+
+ if (!oldRil)
+ rr.mp.writeString(aid);
send(rr);
}
@@ -701,10 +706,14 @@ public final class RIL extends BaseCommands implements CommandsInterface {
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
- rr.mp.writeInt(3);
+ boolean oldRil = needsOldRilFeature("facilitylock");
+
+ rr.mp.writeInt(oldRil ? 2 : 3);
rr.mp.writeString(puk);
rr.mp.writeString(newPin);
- rr.mp.writeString(aid);
+
+ if (!oldRil)
+ rr.mp.writeString(aid);
send(rr);
}
@@ -722,9 +731,13 @@ public final class RIL extends BaseCommands implements CommandsInterface {
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
- rr.mp.writeInt(2);
+ boolean oldRil = needsOldRilFeature("facilitylock");
+
+ rr.mp.writeInt(oldRil ? 1 : 2);
rr.mp.writeString(pin);
- rr.mp.writeString(aid);
+
+ if (!oldRil)
+ rr.mp.writeString(aid);
send(rr);
}
@@ -742,10 +755,14 @@ public final class RIL extends BaseCommands implements CommandsInterface {
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
- rr.mp.writeInt(3);
+ boolean oldRil = needsOldRilFeature("facilitylock");
+
+ rr.mp.writeInt(oldRil ? 2 : 3);
rr.mp.writeString(puk);
rr.mp.writeString(newPin2);
- rr.mp.writeString(aid);
+
+ if (!oldRil)
+ rr.mp.writeString(aid);
send(rr);
}
@@ -763,10 +780,14 @@ public final class RIL extends BaseCommands implements CommandsInterface {
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
- rr.mp.writeInt(3);
+ boolean oldRil = needsOldRilFeature("facilitylock");
+
+ rr.mp.writeInt(oldRil ? 2 : 3);
rr.mp.writeString(oldPin);
rr.mp.writeString(newPin);
- rr.mp.writeString(aid);
+
+ if (!oldRil)
+ rr.mp.writeString(aid);
send(rr);
}
@@ -784,10 +805,14 @@ public final class RIL extends BaseCommands implements CommandsInterface {
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
- rr.mp.writeInt(3);
+ boolean oldRil = needsOldRilFeature("facilitylock");
+
+ rr.mp.writeInt(oldRil ? 2 : 3);
rr.mp.writeString(oldPin2);
rr.mp.writeString(newPin2);
- rr.mp.writeString(aid);
+
+ if (!oldRil)
+ rr.mp.writeString(aid);
send(rr);
}
@@ -1625,14 +1650,18 @@ public final class RIL extends BaseCommands implements CommandsInterface {
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
+ boolean oldRil = needsOldRilFeature("facilitylock");
+
// count strings
- rr.mp.writeInt(4);
+ rr.mp.writeInt(oldRil ? 3 : 4);
rr.mp.writeString(facility);
rr.mp.writeString(password);
rr.mp.writeString(Integer.toString(serviceClass));
- rr.mp.writeString(appId);
+
+ if (!oldRil)
+ rr.mp.writeString(appId);
send(rr);
}
@@ -1654,15 +1683,19 @@ public final class RIL extends BaseCommands implements CommandsInterface {
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
+ boolean oldRil = needsOldRilFeature("facilitylock");
+
// count strings
- rr.mp.writeInt(5);
+ rr.mp.writeInt(oldRil ? 4 : 5);
rr.mp.writeString(facility);
lockString = (lockState)?"1":"0";
rr.mp.writeString(lockString);
rr.mp.writeString(password);
rr.mp.writeString(Integer.toString(serviceClass));
- rr.mp.writeString(appId);
+
+ if (!oldRil)
+ rr.mp.writeString(appId);
send(rr);
@@ -1992,7 +2025,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
//***** Private Methods
- private void sendScreenState(boolean on) {
+ protected void sendScreenState(boolean on) {
RILRequest rr = RILRequest.obtain(RIL_REQUEST_SCREEN_STATE, null);
rr.mp.writeInt(1);
rr.mp.writeInt(on ? 1 : 0);
@@ -2013,7 +2046,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
sendScreenState(true);
}
- private RadioState getRadioStateFromInt(int stateInt) {
+ protected RadioState getRadioStateFromInt(int stateInt) {
RadioState state;
/* RIL_RadioState ril.h */
@@ -2036,7 +2069,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return state;
}
- private void switchToRadioState(RadioState newState) {
+ protected void switchToRadioState(RadioState newState) {
setRadioState(newState);
}
@@ -2073,7 +2106,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
}
}
- private void
+ protected void
send(RILRequest rr) {
Message msg;
@@ -2090,7 +2123,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
msg.sendToTarget();
}
- private void
+ protected void
processResponse (Parcel p) {
int type;
@@ -2110,7 +2143,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
* @param error is the RIL_Errno sent back
* @param loggable true means to print all requests in mRequestslist
*/
- private void clearRequestsList(int error, boolean loggable) {
+ protected void clearRequestsList(int error, boolean loggable) {
RILRequest rr;
synchronized (mRequestsList) {
int count = mRequestsList.size();
@@ -2134,7 +2167,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
}
}
- private RILRequest findAndRemoveRequestFromList(int serial) {
+ protected RILRequest findAndRemoveRequestFromList(int serial) {
synchronized (mRequestsList) {
for (int i = 0, s = mRequestsList.size() ; i < s ; i++) {
RILRequest rr = mRequestsList.get(i);
@@ -2151,7 +2184,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return null;
}
- private void
+ protected void
processSolicited (Parcel p) {
int serial, error;
boolean found = false;
@@ -2322,7 +2355,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
rr.release();
}
- private String
+ protected String
retToString(int req, Object ret) {
if (ret == null) return "";
switch (req) {
@@ -2386,7 +2419,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return s;
}
- private void
+ protected void
processUnsolicited (Parcel p) {
int response;
Object ret;
@@ -2553,6 +2586,10 @@ public final class RIL extends BaseCommands implements CommandsInterface {
case RIL_UNSOL_DATA_CALL_LIST_CHANGED:
if (RILJ_LOGD) unsljLogRet(response, ret);
+ boolean oldRil = needsOldRilFeature("skipbrokendatacall");
+ if (oldRil && "IP".equals(((ArrayList<DataCallState>)ret).get(0).type))
+ break;
+
mDataNetworkStateRegistrants.notifyRegistrants(new AsyncResult(null, ret, null));
break;
@@ -2791,7 +2828,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
}
}
- private Object
+ protected Object
responseInts(Parcel p) {
int numInts;
int response[];
@@ -2808,12 +2845,12 @@ public final class RIL extends BaseCommands implements CommandsInterface {
}
- private Object
+ protected Object
responseVoid(Parcel p) {
return null;
}
- private Object
+ protected Object
responseCallForward(Parcel p) {
int numInfos;
CallForwardInfo infos[];
@@ -2836,7 +2873,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return infos;
}
- private Object
+ protected Object
responseSuppServiceNotification(Parcel p) {
SuppServiceNotification notification = new SuppServiceNotification();
@@ -2849,7 +2886,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return notification;
}
- private Object
+ protected Object
responseCdmaSms(Parcel p) {
SmsMessage sms;
sms = SmsMessage.newFromParcel(p);
@@ -2857,7 +2894,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return sms;
}
- private Object
+ protected Object
responseString(Parcel p) {
String response;
@@ -2866,7 +2903,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return response;
}
- private Object
+ protected Object
responseStrings(Parcel p) {
int num;
String response[];
@@ -2885,7 +2922,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return response;
}
- private Object
+ protected Object
responseRaw(Parcel p) {
int num;
byte response[];
@@ -2895,7 +2932,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return response;
}
- private Object
+ protected Object
responseSMS(Parcel p) {
int messageRef, errorCode;
String ackPDU;
@@ -2910,8 +2947,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {
}
- private Object
- responseICC_IO(Parcel p) {
+ protected Object
+ responseICC_IO(Parcel p) {
int sw1, sw2;
byte data[] = null;
Message ret;
@@ -2929,16 +2966,30 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return new IccIoResult(sw1, sw2, s);
}
- private Object
+ private boolean needsOldRilFeature(String feature) {
+ String[] features = SystemProperties.get("ro.telephony.ril.v3", "").split(",");
+ for (String found: features) {
+ if (found.equals(feature))
+ return true;
+ }
+ return false;
+ }
+
+ protected Object
responseIccCardStatus(Parcel p) {
IccCardApplication ca;
+ boolean oldRil = needsOldRilFeature("icccardstatus");
+
IccCardStatus status = new IccCardStatus();
status.setCardState(p.readInt());
status.setUniversalPinState(p.readInt());
status.setGsmUmtsSubscriptionAppIndex(p.readInt());
status.setCdmaSubscriptionAppIndex(p.readInt());
- status.setImsSubscriptionAppIndex(p.readInt());
+
+ if (!oldRil)
+ status.setImsSubscriptionAppIndex(p.readInt());
+
int numApplications = p.readInt();
// limit to maximum allowed applications
@@ -2962,7 +3013,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return status;
}
- private Object
+ protected Object
responseCallList(Parcel p) {
int num;
int voiceSettings;
@@ -3026,7 +3077,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return response;
}
- private DataCallState getDataCallState(Parcel p, int version) {
+ protected DataCallState getDataCallState(Parcel p, int version) {
DataCallState dataCall = new DataCallState();
dataCall.version = version;
@@ -3034,10 +3085,13 @@ public final class RIL extends BaseCommands implements CommandsInterface {
dataCall.cid = p.readInt();
dataCall.active = p.readInt();
dataCall.type = p.readString();
+ p.readString(); // APN - not used
String addresses = p.readString();
if (!TextUtils.isEmpty(addresses)) {
dataCall.addresses = addresses.split(" ");
}
+ // DataCallState needs an ifname. Since we don't have one use the name from the ThrottleService resource (default=rmnet0).
+ dataCall.ifname = Resources.getSystem().getString(com.android.internal.R.string.config_datause_iface);
} else {
dataCall.status = p.readInt();
dataCall.suggestedRetryTime = p.readInt();
@@ -3065,11 +3119,11 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return dataCall;
}
- private Object
+ protected Object
responseDataCallList(Parcel p) {
ArrayList<DataCallState> response;
-
- int ver = p.readInt();
+ boolean oldRil = needsOldRilFeature("datacall");
+ int ver = (oldRil ? 3 : p.readInt());
int num = p.readInt();
riljLog("responseDataCallList ver=" + ver + " num=" + num);
@@ -3081,9 +3135,10 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return response;
}
- private Object
+ protected Object
responseSetupDataCall(Parcel p) {
- int ver = p.readInt();
+ boolean oldRil = needsOldRilFeature("datacall");
+ int ver = (oldRil ? 3 : p.readInt());
int num = p.readInt();
if (RILJ_LOGV) riljLog("responseSetupDataCall ver=" + ver + " num=" + num);
@@ -3128,7 +3183,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return dataCall;
}
- private Object
+ protected Object
responseOperatorInfos(Parcel p) {
String strings[] = (String [])responseStrings(p);
ArrayList<OperatorInfo> ret;
@@ -3153,8 +3208,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return ret;
}
- private Object
- responseCellList(Parcel p) {
+ protected Object
+ responseCellList(Parcel p) {
int num, rssi;
String location;
ArrayList<NeighboringCellInfo> response;
@@ -3195,7 +3250,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return response;
}
- private Object responseGetPreferredNetworkType(Parcel p) {
+ protected Object responseGetPreferredNetworkType(Parcel p) {
int [] response = (int[]) responseInts(p);
if (response.length >= 1) {
@@ -3207,7 +3262,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return response;
}
- private Object responseGmsBroadcastConfig(Parcel p) {
+ protected Object responseGmsBroadcastConfig(Parcel p) {
int num;
ArrayList<SmsBroadcastConfigInfo> response;
SmsBroadcastConfigInfo info;
@@ -3229,7 +3284,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return response;
}
- private Object
+ protected Object
responseCdmaBroadcastConfig(Parcel p) {
int numServiceCategories;
int response[];
@@ -3268,21 +3323,27 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return response;
}
- private Object
+ protected Object
responseSignalStrength(Parcel p) {
int numInts = 12;
int response[];
+ boolean oldRil = needsOldRilFeature("signalstrength");
+
/* TODO: Add SignalStrength class to match RIL_SignalStrength */
response = new int[numInts];
for (int i = 0 ; i < numInts ; i++) {
- response[i] = p.readInt();
+ if (oldRil && i > 6 && i < 12) {
+ response[i] = -1;
+ } else {
+ response[i] = p.readInt();
+ }
}
return response;
}
- private ArrayList<CdmaInformationRecords>
+ protected ArrayList<CdmaInformationRecords>
responseCdmaInformationRecord(Parcel p) {
int numberOfInfoRecs;
ArrayList<CdmaInformationRecords> response;
@@ -3302,7 +3363,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return response;
}
- private Object
+ protected Object
responseCdmaCallWaiting(Parcel p) {
CdmaCallWaitingNotification notification = new CdmaCallWaitingNotification();
@@ -3320,7 +3381,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return notification;
}
- private Object
+ protected Object
responseCallRing(Parcel p){
char response[] = new char[4];
@@ -3332,7 +3393,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
return response;
}
- private void
+ protected void
notifyRegistrantsCdmaInfoRec(CdmaInformationRecords infoRec) {
int response = RIL_UNSOL_CDMA_INFO_REC;
if (infoRec.record instanceof CdmaInformationRecords.CdmaDisplayInfoRec) {
@@ -3547,27 +3608,27 @@ public final class RIL extends BaseCommands implements CommandsInterface {
}
}
- private void riljLog(String msg) {
+ protected void riljLog(String msg) {
Log.d(LOG_TAG, msg);
}
- private void riljLogv(String msg) {
+ protected void riljLogv(String msg) {
Log.v(LOG_TAG, msg);
}
- private void unsljLog(int response) {
+ protected void unsljLog(int response) {
riljLog("[UNSL]< " + responseToString(response));
}
- private void unsljLogMore(int response, String more) {
+ protected void unsljLogMore(int response, String more) {
riljLog("[UNSL]< " + responseToString(response) + " " + more);
}
- private void unsljLogRet(int response, Object ret) {
+ protected void unsljLogRet(int response, Object ret) {
riljLog("[UNSL]< " + responseToString(response) + " " + retToString(response, ret));
}
- private void unsljLogvRet(int response, Object ret) {
+ protected void unsljLogvRet(int response, Object ret) {
riljLogv("[UNSL]< " + responseToString(response) + " " + retToString(response, ret));
}