Merge "Fix longpress on Menu showing IME."
diff --git a/Android.mk b/Android.mk
index 1b31be1..9d7906e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -474,6 +474,8 @@
LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk
+LOCAL_UNINSTALLABLE_MODULE := true
+
include $(BUILD_DROIDDOC)
# $(gen), i.e. framework.aidl, is also needed while building against the current stub.
@@ -500,6 +502,8 @@
LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk
+LOCAL_UNINSTALLABLE_MODULE := true
+
include $(BUILD_DROIDDOC)
# $(gen), i.e. framework.aidl, is also needed while building against the current stub.
diff --git a/CleanSpec.mk b/CleanSpec.mk
index e961a5a..50bee9c 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -78,6 +78,7 @@
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libhwui.so)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/os/storage/*)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/content/IClipboard.P)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/telephony/java/com/android/internal/telephony/ITelephonyRegistry.P)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/api/9.xml b/api/9.xml
index 08f86e1..6e059c5 100644
--- a/api/9.xml
+++ b/api/9.xml
@@ -793,17 +793,6 @@
visibility="public"
>
</field>
-<field name="READ_OWNER_DATA"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""android.permission.READ_OWNER_DATA""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="READ_PHONE_STATE"
type="java.lang.String"
transient="false"
@@ -1233,17 +1222,6 @@
visibility="public"
>
</field>
-<field name="WRITE_OWNER_DATA"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""android.permission.WRITE_OWNER_DATA""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="WRITE_SECURE_SETTINGS"
type="java.lang.String"
transient="false"
diff --git a/api/current.xml b/api/current.xml
index e2e1346..813f5dc 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -712,7 +712,7 @@
value=""android.permission.PERSISTENT_ACTIVITY""
static="true"
final="true"
- deprecated="not deprecated"
+ deprecated="deprecated"
visibility="public"
>
</field>
@@ -793,17 +793,6 @@
visibility="public"
>
</field>
-<field name="READ_OWNER_DATA"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""android.permission.READ_OWNER_DATA""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="READ_PHONE_STATE"
type="java.lang.String"
transient="false"
@@ -1233,17 +1222,6 @@
visibility="public"
>
</field>
-<field name="WRITE_OWNER_DATA"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""android.permission.WRITE_OWNER_DATA""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="WRITE_SECURE_SETTINGS"
type="java.lang.String"
transient="false"
@@ -23415,7 +23393,7 @@
synchronized="false"
static="false"
final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
visibility="public"
>
<parameter name="isPersistent" type="boolean">
@@ -55586,6 +55564,17 @@
visibility="public"
>
</field>
+<field name="FEATURE_NFC"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.hardware.nfc""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="FEATURE_SENSOR_ACCELEROMETER"
type="java.lang.String"
transient="false"
@@ -55630,6 +55619,28 @@
visibility="public"
>
</field>
+<field name="FEATURE_SIP"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.software.sip""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="FEATURE_SIP_VOIP"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.software.sip.voip""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="FEATURE_TELEPHONY"
type="java.lang.String"
transient="false"
@@ -213724,7 +213735,7 @@
synchronized="true"
static="false"
final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
visibility="public"
>
</method>
@@ -214274,7 +214285,7 @@
synchronized="true"
static="false"
final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
visibility="public"
>
<parameter name="pluginsPath" type="java.lang.String">
@@ -237282,7 +237293,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="arg0" type="T">
+<parameter name="t" type="T">
</parameter>
</method>
</interface>
@@ -264495,7 +264506,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="lng" type="long">
+<parameter name="l" type="long">
</parameter>
</method>
<method name="append"
@@ -264573,7 +264584,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="ch" type="char[]">
+<parameter name="chars" type="char[]">
</parameter>
</method>
<method name="append"
@@ -319144,9 +319155,9 @@
>
<parameter name="number" type="java.lang.Object">
</parameter>
-<parameter name="toAppendTo" type="java.lang.StringBuffer">
+<parameter name="buffer" type="java.lang.StringBuffer">
</parameter>
-<parameter name="pos" type="java.text.FieldPosition">
+<parameter name="position" type="java.text.FieldPosition">
</parameter>
</method>
<method name="getDecimalFormatSymbols"
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index 8f3642c..a09666e 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -115,6 +115,8 @@
"su", "root", "wpa_cli", "list_networks", NULL);
#ifdef FWDUMP_bcm4329
+ run_command("DUMP WIFI STATUS", 20,
+ "su", "root", "dhdutil", "-i", "eth0", "dump", NULL);
run_command("DUMP WIFI FIRMWARE LOG", 60,
"su", "root", "dhdutil", "-i", "eth0", "upload", "/data/local/tmp/wlan_crash.dump", NULL);
#endif
@@ -239,8 +241,18 @@
/* switch to non-root user and group */
gid_t groups[] = { AID_LOG, AID_SDCARD_RW, AID_MOUNT };
- setgroups(sizeof(groups)/sizeof(groups[0]), groups);
- setuid(AID_SHELL);
+ if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) {
+ LOGE("Unable to setgroups, aborting: %s\n", strerror(errno));
+ return -1;
+ }
+ if (setgid(AID_SHELL) != 0) {
+ LOGE("Unable to setgid, aborting: %s\n", strerror(errno));
+ return -1;
+ }
+ if (setuid(AID_SHELL) != 0) {
+ LOGE("Unable to setuid, aborting: %s\n", strerror(errno));
+ return -1;
+ }
char path[PATH_MAX], tmp_path[PATH_MAX];
pid_t gzip_pid = -1;
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 3fe971f..068f821 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -1751,6 +1751,9 @@
}
/**
+ * @deprecated This functionality will be removed in the future; please do
+ * not use.
+ *
* Control whether this activity is required to be persistent. By default
* activities are not persistent; setting this to true will prevent the
* system from stopping this activity or its process when running low on
@@ -1765,6 +1768,7 @@
* persistent, true if so, false for the normal
* behavior.
*/
+ @Deprecated
public void setPersistent(boolean isPersistent) {
if (mParent == null) {
try {
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 4de0b0a..fe179d1 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -850,10 +850,6 @@
}
private final class H extends Handler {
- private H() {
- SamplingProfiler.getInstance().setEventThread(mLooper.getThread());
- }
-
public static final int LAUNCH_ACTIVITY = 100;
public static final int PAUSE_ACTIVITY = 101;
public static final int PAUSE_ACTIVITY_FINISHING= 102;
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 7f166cf..33a1db8 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -705,6 +705,14 @@
/**
* Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: The device can communicate using Near-Field
+ * Communications (NFC).
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_NFC = "android.hardware.nfc";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
* {@link #hasSystemFeature}: The device includes a magnetometer (compass).
*/
@SdkConstant(SdkConstantType.FEATURE)
@@ -752,7 +760,21 @@
*/
@SdkConstant(SdkConstantType.FEATURE)
public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
-
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: The SIP API is enabled on the device.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_SIP = "android.software.sip";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: The device supports SIP-based VOIP.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
+
/**
* Feature for {@link #getSystemAvailableFeatures} and
* {@link #hasSystemFeature}: The device's display has a touch screen.
diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java
index 0498fff..f3f2d60 100644
--- a/core/java/android/net/MobileDataStateTracker.java
+++ b/core/java/android/net/MobileDataStateTracker.java
@@ -160,7 +160,6 @@
if (intent.getAction().equals(TelephonyIntents.
ACTION_ANY_DATA_CONNECTION_STATE_CHANGED)) {
String apnType = intent.getStringExtra(Phone.DATA_APN_TYPE_KEY);
-
if (!TextUtils.equals(apnType, mApnType)) {
return;
}
@@ -169,9 +168,8 @@
String reason = intent.getStringExtra(Phone.STATE_CHANGE_REASON_KEY);
String apnName = intent.getStringExtra(Phone.DATA_APN_KEY);
- boolean unavailable = intent.getBooleanExtra(Phone.NETWORK_UNAVAILABLE_KEY,
- false);
- mNetworkInfo.setIsAvailable(!unavailable);
+ mNetworkInfo.setIsAvailable(!intent.getBooleanExtra(Phone.NETWORK_UNAVAILABLE_KEY,
+ false));
if (DBG) Log.d(TAG, mApnType + " Received state= " + state + ", old= " +
mMobileDataState + ", reason= " +
@@ -267,24 +265,7 @@
* Report whether data connectivity is possible.
*/
public boolean isAvailable() {
- getPhoneService(false);
-
- /*
- * If the phone process has crashed in the past, we'll get a
- * RemoteException and need to re-reference the service.
- */
- for (int retry = 0; retry < 2; retry++) {
- if (mPhoneService == null) break;
-
- try {
- return mPhoneService.isDataConnectivityPossible();
- } catch (RemoteException e) {
- // First-time failed, get the phone service again
- if (retry == 0) getPhoneService(true);
- }
- }
-
- return false;
+ return mNetworkInfo.isAvailable();
}
/**
diff --git a/core/java/android/net/ProxyProperties.java b/core/java/android/net/ProxyProperties.java
index 17d0ec0..bce7ec0 100644
--- a/core/java/android/net/ProxyProperties.java
+++ b/core/java/android/net/ProxyProperties.java
@@ -75,8 +75,12 @@
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
- sb.append(mProxy.getHostAddress()).append(":").append(mPort)
- .append(" xl=").append(mExclusionList);
+ if (mProxy != null) {
+ sb.append(mProxy.getHostAddress()).append(":").append(mPort);
+ if (mExclusionList != null) {
+ sb.append(" xl=").append(mExclusionList);
+ }
+ }
return sb.toString();
}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index d1ca723..dcd1d94 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2385,6 +2385,12 @@
public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy";
/**
+ * Setting for default DNS in case nobody suggests one
+ * @hide
+ */
+ public static final String DEFAULT_DNS_SERVER = "default_dns_server";
+
+ /**
* Whether the package installer should allow installation of apps downloaded from
* sources other than the Android Market (vending machine).
*
@@ -2415,6 +2421,14 @@
"lock_pattern_tactile_feedback_enabled";
/**
+ * This preference allows the device to be locked given time after screen goes off,
+ * subject to current DeviceAdmin policy limits.
+ * @hide
+ */
+ public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout";
+
+
+ /**
* Whether assisted GPS should be enabled or not.
* @hide
*/
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java
index 65cb182..11a5d69 100644
--- a/core/java/android/view/GLES20Canvas.java
+++ b/core/java/android/view/GLES20Canvas.java
@@ -320,7 +320,7 @@
@Override
public int save() {
- return nSave(mRenderer, 0);
+ return nSave(mRenderer, Canvas.CLIP_SAVE_FLAG | Canvas.MATRIX_SAVE_FLAG);
}
@Override
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 38b3e88..0ed5fc5 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -1102,8 +1102,13 @@
}
/**
- * TODO: need to add @Deprecated
+ * Set a custom path to plugins used by the WebView. This method is
+ * obsolete since each plugin is now loaded from its own package.
+ * @param pluginsPath String path to the directory containing plugins.
+ * @deprecated This method is no longer used as plugins are loaded from
+ * their own APK via the system's package manager.
*/
+ @Deprecated
public synchronized void setPluginsPath(String pluginsPath) {
}
@@ -1286,8 +1291,13 @@
}
/**
- * TODO: need to add @Deprecated
+ * Returns the directory that contains the plugin libraries. This method is
+ * obsolete since each plugin is now loaded from its own package.
+ * @return An empty string.
+ * @deprecated This method is no longer used as plugins are loaded from
+ * their own APK via the system's package manager.
*/
+ @Deprecated
public synchronized String getPluginsPath() {
return "";
}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index d4ef0f0..0b236af 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1798,11 +1798,11 @@
/**
* Returns true if private browsing is enabled in this WebView.
*/
- public boolean isPrivateBrowsingEnabled () {
+ public boolean isPrivateBrowsingEnabled() {
return getSettings().isPrivateBrowsingEnabled();
}
- private void startPrivateBrowsing () {
+ private void startPrivateBrowsing() {
boolean wasPrivateBrowsingEnabled = isPrivateBrowsingEnabled();
getSettings().setPrivateBrowsingEnabled(true);
@@ -1812,6 +1812,23 @@
}
}
+ /**
+ * Deletes any files that were created as a part of the last private
+ * browsing session and clears any internal state associated with that
+ * session. The consequences of calling this method while a private
+ * browsing session is active are unspecified.
+ * @param context The same context which was used to create the private
+ * browsing WebView.
+ * @return True if the private browsing files were successfully deleted,
+ * false otherwise.
+ * @hide pending API council approval.
+ */
+ public static boolean cleanupPrivateBrowsingFiles(Context context) {
+ return nativeCleanupPrivateBrowsingFiles(context.getFilesDir().getParent());
+ }
+
+ private static native boolean nativeCleanupPrivateBrowsingFiles(String dataDirectory);
+
private boolean extendScroll(int y) {
int finalY = mScroller.getFinalY();
int newY = pinLocY(finalY + y);
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 197ad9ee..d87f55f 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -16,12 +16,11 @@
package android.widget;
-import com.android.internal.R;
-
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.graphics.Canvas;
+import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.TransitionDrawable;
@@ -57,6 +56,8 @@
import android.view.inputmethod.InputConnectionWrapper;
import android.view.inputmethod.InputMethodManager;
+import com.android.internal.R;
+
import java.util.ArrayList;
import java.util.List;
@@ -4235,7 +4236,11 @@
/**
* When set to a non-zero value, the cache color hint indicates that this list is always drawn
- * on top of a solid, single-color, opaque background
+ * on top of a solid, single-color, opaque background.
+ *
+ * Zero means that what's behind this object is translucent (non solid) or is not made of a
+ * single color. This hint will not affect any existing background drawable set on this view (
+ * typically set via {@link #setBackgroundDrawable(Drawable)}).
*
* @param color The background color
*/
diff --git a/core/java/com/android/internal/os/SamplingProfilerIntegration.java b/core/java/com/android/internal/os/SamplingProfilerIntegration.java
index 38362c1..b87ac90 100644
--- a/core/java/com/android/internal/os/SamplingProfilerIntegration.java
+++ b/core/java/com/android/internal/os/SamplingProfilerIntegration.java
@@ -16,16 +16,19 @@
package com.android.internal.os;
-import android.content.pm.PackageInfo;
import dalvik.system.SamplingProfiler;
+import java.io.BufferedOutputStream;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.PrintStream;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicBoolean;
+import android.content.pm.PackageInfo;
import android.util.Log;
import android.os.*;
@@ -41,7 +44,7 @@
private static final boolean enabled;
private static final Executor snapshotWriter;
private static final int samplingProfilerHz;
-
+
/** Whether or not we've created the snapshots dir. */
private static boolean dirMade = false;
@@ -61,6 +64,8 @@
}
}
+ private static SamplingProfiler INSTANCE;
+
/**
* Is profiling enabled?
*/
@@ -72,15 +77,22 @@
* Starts the profiler if profiling is enabled.
*/
public static void start() {
- if (!enabled) return;
- SamplingProfiler.getInstance().start(samplingProfilerHz);
+ if (!enabled) {
+ return;
+ }
+ ThreadGroup group = Thread.currentThread().getThreadGroup();
+ SamplingProfiler.ThreadSet threadSet = SamplingProfiler.newThreadGroupTheadSet(group);
+ INSTANCE = new SamplingProfiler(4, threadSet);
+ INSTANCE.start(samplingProfilerHz);
}
/**
* Writes a snapshot if profiling is enabled.
*/
public static void writeSnapshot(final String processName, final PackageInfo packageInfo) {
- if (!enabled) return;
+ if (!enabled) {
+ return;
+ }
/*
* If we're already writing a snapshot, don't bother enqueueing another
@@ -122,18 +134,22 @@
* Writes the zygote's snapshot to internal storage if profiling is enabled.
*/
public static void writeZygoteSnapshot() {
- if (!enabled) return;
+ if (!enabled) {
+ return;
+ }
writeSnapshot("zygote", null);
+ INSTANCE.shutdown();
+ INSTANCE = null;
}
/**
* pass in PackageInfo to retrieve various values for snapshot header
*/
private static void writeSnapshot(String dir, String processName, PackageInfo packageInfo) {
- byte[] snapshot = SamplingProfiler.getInstance().snapshot();
- if (snapshot == null) {
+ if (!enabled) {
return;
}
+ INSTANCE.stop();
/*
* We use the current time as a unique ID. We can't use a counter
@@ -143,21 +159,22 @@
long start = System.currentTimeMillis();
String name = processName.replaceAll(":", ".");
String path = dir + "/" + name + "-" +System.currentTimeMillis() + ".snapshot";
- FileOutputStream out = null;
+ PrintStream out = null;
try {
- out = new FileOutputStream(path);
- generateSnapshotHeader(name, packageInfo, out);
- out.write(snapshot);
+ out = new PrintStream(new BufferedOutputStream(new FileOutputStream(path)));
} catch (IOException e) {
- Log.e(TAG, "Error writing snapshot.", e);
+ Log.e(TAG, "Could not open " + path + ":" + e);
+ return;
+ }
+ try {
+ generateSnapshotHeader(name, packageInfo, out);
+ INSTANCE.writeHprofData(out);
} finally {
- try {
- if(out != null) {
- out.close();
- }
- } catch (IOException ex) {
- // let it go.
- }
+ out.close();
+ }
+ if (out.checkError()) {
+ Log.e(TAG, "Error writing snapshot.");
+ return;
}
// set file readable to the world so that SamplingProfilerService
// can put it to dropbox
@@ -179,16 +196,16 @@
* <the actual snapshot content begins here...>
*/
private static void generateSnapshotHeader(String processName, PackageInfo packageInfo,
- FileOutputStream out) throws IOException {
+ PrintStream out) {
// profiler version
- out.write("Version: 1\n".getBytes());
- out.write(("Process: " + processName + "\n").getBytes());
- if(packageInfo != null) {
- out.write(("Package: " + packageInfo.packageName + "\n").getBytes());
- out.write(("Package-Version: " + packageInfo.versionCode + "\n").getBytes());
+ out.println("Version: 2");
+ out.println("Process: " + processName);
+ if (packageInfo != null) {
+ out.println("Package: " + packageInfo.packageName);
+ out.println("Package-Version: " + packageInfo.versionCode);
}
- out.write(("Build: " + Build.FINGERPRINT + "\n").getBytes());
+ out.println("Build: " + Build.FINGERPRINT);
// single blank line means the end of snapshot header.
- out.write("\n".getBytes());
+ out.println();
}
}
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
index 9c84e0e..f0f3387 100644
--- a/core/java/com/android/internal/os/ZygoteInit.java
+++ b/core/java/com/android/internal/os/ZygoteInit.java
@@ -579,12 +579,8 @@
EventLog.writeEvent(LOG_BOOT_PROGRESS_PRELOAD_END,
SystemClock.uptimeMillis());
- if (SamplingProfilerIntegration.isEnabled()) {
- SamplingProfiler sp = SamplingProfiler.getInstance();
- sp.pause();
- SamplingProfilerIntegration.writeZygoteSnapshot();
- sp.shutDown();
- }
+ // Finish profiling the zygote initialization.
+ SamplingProfilerIntegration.writeZygoteSnapshot();
// Do an initial gc to clean up after startup
gc();
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 6f6d919..c9d7e7f 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -308,6 +308,8 @@
jclass clazz;
jmethodID methodId;
+ LOGD("Calling main entry %s", className);
+
env = getJNIEnv();
if (env == NULL)
return UNKNOWN_ERROR;
@@ -914,7 +916,8 @@
*/
void AndroidRuntime::start(const char* className, const bool startSystemServer)
{
- LOGD("\n>>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<\n");
+ LOGD("\n>>>>>> AndroidRuntime START %s <<<<<<\n",
+ className != NULL ? className : "(unknown)");
char* slashClassName = NULL;
char* cp;
@@ -1029,7 +1032,7 @@
void AndroidRuntime::onExit(int code)
{
- LOGI("AndroidRuntime onExit calling exit(%d)", code);
+ LOGV("AndroidRuntime onExit calling exit(%d)", code);
exit(code);
}
@@ -1334,7 +1337,7 @@
*/
androidSetCreateThreadFunc((android_create_thread_fn) javaCreateThreadEtc);
- LOGD("--- registering native functions ---\n");
+ LOGV("--- registering native functions ---\n");
/*
* Every "register" function calls one or more things that return
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 1f66d05..2cd38cd 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -193,20 +193,6 @@
android:label="@string/permlab_writeContacts"
android:description="@string/permdesc_writeContacts" />
- <!-- Allows an application to read the owner's data. -->
- <permission android:name="android.permission.READ_OWNER_DATA"
- android:permissionGroup="android.permission-group.PERSONAL_INFO"
- android:protectionLevel="dangerous"
- android:label="@string/permlab_readOwnerData"
- android:description="@string/permdesc_readOwnerData" />
-
- <!-- Allows an application to write (but not read) the owner's data. -->
- <permission android:name="android.permission.WRITE_OWNER_DATA"
- android:permissionGroup="android.permission-group.PERSONAL_INFO"
- android:protectionLevel="dangerous"
- android:label="@string/permlab_writeOwnerData"
- android:description="@string/permdesc_writeOwnerData" />
-
<!-- Allows an application to read the user's calendar data. -->
<permission android:name="android.permission.READ_CALENDAR"
android:permissionGroup="android.permission-group.PERSONAL_INFO"
@@ -634,7 +620,10 @@
android:label="@string/permlab_setAnimationScale"
android:description="@string/permdesc_setAnimationScale" />
- <!-- Allow an application to make its activities persistent. -->
+ <!-- @deprecated This functionality will be removed in the future; please do
+ not use.
+
+ Allow an application to make its activities persistent. -->
<permission android:name="android.permission.PERSISTENT_ACTIVITY"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="dangerous"
@@ -776,7 +765,7 @@
<!-- Allows applications to disable the keyguard -->
<permission android:name="android.permission.DISABLE_KEYGUARD"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
- android:protectionLevel="normal"
+ android:protectionLevel="dangerous"
android:description="@string/permdesc_disableKeyguard"
android:label="@string/permlab_disableKeyguard" />
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index a071cac..988176d 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -399,4 +399,6 @@
device is data-only. -->
<bool name="config_voice_capable">true</bool>
+ <!-- IP address of the dns server to use if nobody else suggests one -->
+ <string name="config_default_dns_server">8.8.8.8</string>
</resources>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index e9295f5..e9d799b 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -784,20 +784,6 @@
applications can use this to erase or modify your contact data.</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
- <string name="permlab_writeOwnerData">write owner data</string>
- <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
- <string name="permdesc_writeOwnerData">Allows an application to modify the
- phone owner data stored on your phone. Malicious
- applications can use this to erase or modify owner data.</string>
-
- <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
- <string name="permlab_readOwnerData">read owner data</string>
- <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
- <string name="permdesc_readOwnerData">Allows an application read the
- phone owner data stored on your phone. Malicious
- applications can use this to read phone owner data.</string>
-
- <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_readCalendar">read calendar events</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_readCalendar">Allows an application to read all
diff --git a/data/etc/android.hardware.nfc.xml b/data/etc/android.hardware.nfc.xml
new file mode 100644
index 0000000..81c4a84
--- /dev/null
+++ b/data/etc/android.hardware.nfc.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+
+<!-- This is the standard feature indicating that the device can communicate
+ using Near-Field Communications (NFC). -->
+<permissions>
+ <feature name="android.hardware.nfc" />
+</permissions>
diff --git a/data/etc/android.software.sip.voip.xml b/data/etc/android.software.sip.voip.xml
new file mode 100644
index 0000000..edd06c1
--- /dev/null
+++ b/data/etc/android.software.sip.voip.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<!-- This is the standard set of features for devices that support SIP-based VoIP. -->
+<permissions>
+ <feature name="android.software.sip" />
+ <feature name="android.software.sip.voip" />
+</permissions>
diff --git a/data/etc/android.software.sip.xml b/data/etc/android.software.sip.xml
new file mode 100644
index 0000000..d9fcaad
--- /dev/null
+++ b/data/etc/android.software.sip.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<!-- This is the standard set of features for devices that support the SIP API. -->
+<permissions>
+ <feature name="android.software.sip" />
+</permissions>
diff --git a/data/etc/platform.xml b/data/etc/platform.xml
index 0e5df8c..439fc90 100644
--- a/data/etc/platform.xml
+++ b/data/etc/platform.xml
@@ -94,8 +94,6 @@
<assign-permission name="android.permission.CALL_PHONE" uid="shell" />
<assign-permission name="android.permission.READ_CONTACTS" uid="shell" />
<assign-permission name="android.permission.WRITE_CONTACTS" uid="shell" />
- <assign-permission name="android.permission.READ_OWNER_DATA" uid="shell" />
- <assign-permission name="android.permission.WRITE_OWNER_DATA" uid="shell" />
<assign-permission name="android.permission.READ_CALENDAR" uid="shell" />
<assign-permission name="android.permission.WRITE_CALENDAR" uid="shell" />
<assign-permission name="android.permission.READ_USER_DICTIONARY" uid="shell" />
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index ee5dbc1..985d700 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -162,7 +162,6 @@
}
-
public void subData2D(int xoff, int yoff, int w, int h, int[] d) {
mRS.validate();
mRS.nAllocationSubData2D(mID, xoff, yoff, w, h, d, d.length * 4);
@@ -183,20 +182,6 @@
mRS.nAllocationRead(mID, d);
}
- public void data(Object o) {
- mRS.validate();
- mRS.nAllocationSubDataFromObject(mID, mType, 0, o);
- }
-
- public void read(Object o) {
- mRS.validate();
- mRS.nAllocationSubReadFromObject(mID, mType, 0, o);
- }
-
- public void subData(int offset, Object o) {
- mRS.validate();
- mRS.nAllocationSubDataFromObject(mID, mType, offset, o);
- }
public class Adapter1D extends BaseObj {
Adapter1D(int id, RenderScript rs) {
diff --git a/graphics/java/android/renderscript/ProgramRaster.java b/graphics/java/android/renderscript/ProgramRaster.java
index fd89b6e..791dac8 100644
--- a/graphics/java/android/renderscript/ProgramRaster.java
+++ b/graphics/java/android/renderscript/ProgramRaster.java
@@ -55,13 +55,13 @@
mCullMode = CullMode.BACK;
}
- public void setLineWidth(float w) {
+ void setLineWidth(float w) {
mRS.validate();
mLineWidth = w;
mRS.nProgramRasterSetLineWidth(mID, w);
}
- public void setCullMode(CullMode m) {
+ void setCullMode(CullMode m) {
mRS.validate();
mCullMode = m;
mRS.nProgramRasterSetCullMode(mID, m.mID);
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index d51257b..62d70a7 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -177,14 +177,6 @@
synchronized int nTypeCreate() {
return rsnTypeCreate(mContext);
}
- native void rsnTypeFinalDestroy(int con, Type t);
- synchronized void nTypeFinalDestroy(Type t) {
- rsnTypeFinalDestroy(mContext, t);
- }
- native void rsnTypeSetupFields(int con, Type t, int[] types, int[] bits, Field[] IDs);
- synchronized void nTypeSetupFields(Type t, int[] types, int[] bits, Field[] IDs) {
- rsnTypeSetupFields(mContext, t, types, bits, IDs);
- }
native void rsnTypeGetNativeData(int con, int id, int[] typeData);
synchronized void nTypeGetNativeData(int id, int[] typeData) {
rsnTypeGetNativeData(mContext, id, typeData);
@@ -257,14 +249,6 @@
synchronized void nAllocationRead(int id, float[] d) {
rsnAllocationRead(mContext, id, d);
}
- native void rsnAllocationSubDataFromObject(int con, int id, Type t, int offset, Object o);
- synchronized void nAllocationSubDataFromObject(int id, Type t, int offset, Object o) {
- rsnAllocationSubDataFromObject(mContext, id, t, offset, o);
- }
- native void rsnAllocationSubReadFromObject(int con, int id, Type t, int offset, Object o);
- synchronized void nAllocationSubReadFromObject(int id, Type t, int offset, Object o) {
- rsnAllocationSubReadFromObject(mContext, id, t, offset, o);
- }
native int rsnAllocationGetType(int con, int id);
synchronized int nAllocationGetType(int id) {
return rsnAllocationGetType(mContext, id);
diff --git a/graphics/java/android/renderscript/Type.java b/graphics/java/android/renderscript/Type.java
index 21053c9..0b3db69 100644
--- a/graphics/java/android/renderscript/Type.java
+++ b/graphics/java/android/renderscript/Type.java
@@ -33,7 +33,6 @@
int mElementCount;
Element mElement;
- private int mNativeCache;
Class mJavaClass;
public Element getElement() {
@@ -98,14 +97,9 @@
Type(int id, RenderScript rs) {
super(id, rs);
- mNativeCache = 0;
}
protected void finalize() throws Throwable {
- if(mNativeCache != 0) {
- mRS.nTypeFinalDestroy(this);
- mNativeCache = 0;
- }
super.finalize();
}
diff --git a/graphics/jni/Android.mk b/graphics/jni/Android.mk
index 8476be1..4c4a128 100644
--- a/graphics/jni/Android.mk
+++ b/graphics/jni/Android.mk
@@ -13,14 +13,13 @@
LOCAL_SHARED_LIBRARIES := \
libandroid_runtime \
- libacc \
libnativehelper \
libRS \
libcutils \
libskia \
libutils \
libui \
- libsurfaceflinger_client
+ libsurfaceflinger_client
LOCAL_STATIC_LIBRARIES :=
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 23b71b0..c8e6656 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -70,9 +70,6 @@
jclass bitmapClass = _env->FindClass("android/graphics/Bitmap");
gNativeBitmapID = _env->GetFieldID(bitmapClass, "mNativeBitmap", "I");
-
- jclass typeClass = _env->FindClass("android/renderscript/Type");
- gTypeNativeCache = _env->GetFieldID(typeClass, "mNativeCache", "I");
}
static void nInitElements(JNIEnv *_env, jobject _this, jint a8, jint rgba4444, jint rgba8888, jint rgb565)
@@ -360,124 +357,6 @@
}
}
-static void * SF_LoadInt(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer)
-{
- ((int32_t *)buffer)[0] = _env->GetIntField(_obj, _field);
- return ((uint8_t *)buffer) + 4;
-}
-
-static void * SF_LoadShort(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer)
-{
- ((int16_t *)buffer)[0] = _env->GetShortField(_obj, _field);
- return ((uint8_t *)buffer) + 2;
-}
-
-static void * SF_LoadByte(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer)
-{
- ((int8_t *)buffer)[0] = _env->GetByteField(_obj, _field);
- return ((uint8_t *)buffer) + 1;
-}
-
-static void * SF_LoadFloat(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer)
-{
- ((float *)buffer)[0] = _env->GetFloatField(_obj, _field);
- return ((uint8_t *)buffer) + 4;
-}
-
-static void * SF_SaveInt(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer)
-{
- _env->SetIntField(_obj, _field, ((int32_t *)buffer)[0]);
- return ((uint8_t *)buffer) + 4;
-}
-
-static void * SF_SaveShort(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer)
-{
- _env->SetShortField(_obj, _field, ((int16_t *)buffer)[0]);
- return ((uint8_t *)buffer) + 2;
-}
-
-static void * SF_SaveByte(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer)
-{
- _env->SetByteField(_obj, _field, ((int8_t *)buffer)[0]);
- return ((uint8_t *)buffer) + 1;
-}
-
-static void * SF_SaveFloat(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer)
-{
- _env->SetFloatField(_obj, _field, ((float *)buffer)[0]);
- return ((uint8_t *)buffer) + 4;
-}
-
-struct TypeFieldCache {
- jfieldID field;
- int bits;
- void * (*ptr)(JNIEnv *, jobject, jfieldID, void *buffer);
- void * (*readPtr)(JNIEnv *, jobject, jfieldID, void *buffer);
-};
-
-struct TypeCache {
- int fieldCount;
- int size;
- TypeFieldCache fields[1];
-};
-
-//{"nTypeFinalDestroy", "(Landroid/renderscript/Type;)V", (void*)nTypeFinalDestroy },
-static void
-nTypeFinalDestroy(JNIEnv *_env, jobject _this, RsContext con, jobject _type)
-{
- TypeCache *tc = (TypeCache *)_env->GetIntField(_type, gTypeNativeCache);
- free(tc);
-}
-
-// native void nTypeSetupFields(Type t, int[] types, int[] bits, Field[] IDs);
-static void
-nTypeSetupFields(JNIEnv *_env, jobject _this, RsContext con, jobject _type, jintArray _types, jintArray _bits, jobjectArray _IDs)
-{
- int fieldCount = _env->GetArrayLength(_types);
- size_t structSize = sizeof(TypeCache) + (sizeof(TypeFieldCache) * (fieldCount-1));
- TypeCache *tc = (TypeCache *)malloc(structSize);
- memset(tc, 0, structSize);
-
- TypeFieldCache *tfc = &tc->fields[0];
- tc->fieldCount = fieldCount;
- _env->SetIntField(_type, gTypeNativeCache, (jint)tc);
-
- jint *fType = _env->GetIntArrayElements(_types, NULL);
- jint *fBits = _env->GetIntArrayElements(_bits, NULL);
- for (int ct=0; ct < fieldCount; ct++) {
- jobject field = _env->GetObjectArrayElement(_IDs, ct);
- tfc[ct].field = _env->FromReflectedField(field);
- tfc[ct].bits = fBits[ct];
-
- switch(fType[ct]) {
- case RS_TYPE_FLOAT_32:
- tfc[ct].ptr = SF_LoadFloat;
- tfc[ct].readPtr = SF_SaveFloat;
- break;
- case RS_TYPE_UNSIGNED_32:
- case RS_TYPE_SIGNED_32:
- tfc[ct].ptr = SF_LoadInt;
- tfc[ct].readPtr = SF_SaveInt;
- break;
- case RS_TYPE_UNSIGNED_16:
- case RS_TYPE_SIGNED_16:
- tfc[ct].ptr = SF_LoadShort;
- tfc[ct].readPtr = SF_SaveShort;
- break;
- case RS_TYPE_UNSIGNED_8:
- case RS_TYPE_SIGNED_8:
- tfc[ct].ptr = SF_LoadByte;
- tfc[ct].readPtr = SF_SaveByte;
- break;
- }
- tc->size += 4;
- }
-
- _env->ReleaseIntArrayElements(_types, fType, JNI_ABORT);
- _env->ReleaseIntArrayElements(_bits, fBits, JNI_ABORT);
-}
-
-
// -----------------------------------
static jint
@@ -699,45 +578,6 @@
_env->ReleaseFloatArrayElements(data, ptr, 0);
}
-
-//{"nAllocationDataFromObject", "(ILandroid/renderscript/Type;Ljava/lang/Object;)V", (void*)nAllocationDataFromObject },
-static void
-nAllocationSubDataFromObject(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jobject _type, jint offset, jobject _o)
-{
- LOG_API("nAllocationDataFromObject con(%p), alloc(%p)", con, (RsAllocation)alloc);
-
- const TypeCache *tc = (TypeCache *)_env->GetIntField(_type, gTypeNativeCache);
-
- void * bufAlloc = malloc(tc->size);
- void * buf = bufAlloc;
- for (int ct=0; ct < tc->fieldCount; ct++) {
- const TypeFieldCache *tfc = &tc->fields[ct];
- buf = tfc->ptr(_env, _o, tfc->field, buf);
- }
- rsAllocation1DSubData(con, (RsAllocation)alloc, offset, 1, bufAlloc, tc->size);
- free(bufAlloc);
-}
-
-static void
-nAllocationSubReadFromObject(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jobject _type, jint offset, jobject _o)
-{
- LOG_API("nAllocationReadFromObject con(%p), alloc(%p)", con, (RsAllocation)alloc);
-
- assert(offset == 0);
-
- const TypeCache *tc = (TypeCache *)_env->GetIntField(_type, gTypeNativeCache);
-
- void * bufAlloc = malloc(tc->size);
- void * buf = bufAlloc;
- rsAllocationRead(con, (RsAllocation)alloc, bufAlloc);
-
- for (int ct=0; ct < tc->fieldCount; ct++) {
- const TypeFieldCache *tfc = &tc->fields[ct];
- buf = tfc->readPtr(_env, _o, tfc->field, buf);
- }
- free(bufAlloc);
-}
-
static jint
nAllocationGetType(JNIEnv *_env, jobject _this, RsContext con, jint a)
{
@@ -1397,8 +1237,6 @@
{"rsnTypeBegin", "(II)V", (void*)nTypeBegin },
{"rsnTypeAdd", "(III)V", (void*)nTypeAdd },
{"rsnTypeCreate", "(I)I", (void*)nTypeCreate },
-{"rsnTypeFinalDestroy", "(ILandroid/renderscript/Type;)V", (void*)nTypeFinalDestroy },
-{"rsnTypeSetupFields", "(ILandroid/renderscript/Type;[I[I[Ljava/lang/reflect/Field;)V", (void*)nTypeSetupFields },
{"rsnTypeGetNativeData", "(II[I)V", (void*)nTypeGetNativeData },
{"rsnAllocationCreateTyped", "(II)I", (void*)nAllocationCreateTyped },
@@ -1417,8 +1255,6 @@
{"rsnAllocationSubData2D", "(IIIIII[FI)V", (void*)nAllocationSubData2D_f },
{"rsnAllocationRead", "(II[I)V", (void*)nAllocationRead_i },
{"rsnAllocationRead", "(II[F)V", (void*)nAllocationRead_f },
-{"rsnAllocationSubDataFromObject", "(IILandroid/renderscript/Type;ILjava/lang/Object;)V", (void*)nAllocationSubDataFromObject },
-{"rsnAllocationSubReadFromObject", "(IILandroid/renderscript/Type;ILjava/lang/Object;)V", (void*)nAllocationSubReadFromObject },
{"rsnAllocationGetType", "(II)I", (void*)nAllocationGetType},
{"rsnAdapter1DBindAllocation", "(III)V", (void*)nAdapter1DBindAllocation },
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 02f5dc5..47ab355 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -127,7 +127,8 @@
}
void OpenGLRenderer::prepare() {
- mSnapshot = new Snapshot(mFirstSnapshot);
+ mSnapshot = new Snapshot(mFirstSnapshot,
+ SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag);
mSaveCount = 1;
glViewport(0, 0, mWidth, mHeight);
@@ -175,7 +176,7 @@
}
int OpenGLRenderer::save(int flags) {
- return saveSnapshot();
+ return saveSnapshot(flags);
}
void OpenGLRenderer::restore() {
@@ -192,8 +193,8 @@
}
}
-int OpenGLRenderer::saveSnapshot() {
- mSnapshot = new Snapshot(mSnapshot);
+int OpenGLRenderer::saveSnapshot(int flags) {
+ mSnapshot = new Snapshot(mSnapshot, flags);
return mSaveCount++;
}
@@ -231,7 +232,7 @@
int OpenGLRenderer::saveLayer(float left, float top, float right, float bottom,
const SkPaint* p, int flags) {
- int count = saveSnapshot();
+ int count = saveSnapshot(flags);
int alpha = 255;
SkXfermode::Mode mode;
@@ -258,13 +259,13 @@
int OpenGLRenderer::saveLayerAlpha(float left, float top, float right, float bottom,
int alpha, int flags) {
- int count = saveSnapshot();
- if (alpha > 0 && !mSnapshot->invisible) {
- createLayer(mSnapshot, left, top, right, bottom, alpha, SkXfermode::kSrcOver_Mode, flags);
+ if (alpha == 0xff) {
+ return saveLayer(left, top, right, bottom, NULL, flags);
} else {
- mSnapshot->invisible = true;
+ SkPaint paint;
+ paint.setAlpha(alpha);
+ return saveLayer(left, top, right, bottom, &paint, flags);
}
- return count;
}
bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top,
@@ -272,8 +273,12 @@
LAYER_LOGD("Requesting layer %fx%f", right - left, bottom - top);
LAYER_LOGD("Layer cache size = %d", mCaches.layerCache.getSize());
+ Rect bounds(left, top, right, bottom);
+ // TODO: Apply transformations and treat layers in screen coordinates
+ // mSnapshot->transform->mapRect(bounds);
+
GLuint previousFbo = snapshot->previous.get() ? snapshot->previous->fbo : 0;
- LayerSize size(right - left, bottom - top);
+ LayerSize size(bounds.getWidth(), bounds.getHeight());
Layer* layer = mCaches.layerCache.get(size, previousFbo);
if (!layer) {
@@ -290,24 +295,26 @@
layer->mode = mode;
layer->alpha = alpha / 255.0f;
- layer->layer.set(left, top, right, bottom);
+ layer->layer.set(bounds);
// Save the layer in the snapshot
snapshot->flags |= Snapshot::kFlagIsLayer;
snapshot->layer = layer;
snapshot->fbo = layer->fbo;
- snapshot->transform.loadTranslate(-left, -top, 0.0f);
- snapshot->setClip(0.0f, 0.0f, right - left, bottom - top);
- snapshot->viewport.set(0.0f, 0.0f, right - left, bottom - top);
- snapshot->height = bottom - top;
+ // TODO: Temporary until real layer support is implemented
+ snapshot->resetTransform(-bounds.left, -bounds.top, 0.0f);
+ // TODO: Temporary until real layer support is implemented
+ snapshot->resetClip(0.0f, 0.0f, bounds.getWidth(), bounds.getHeight());
+ snapshot->viewport.set(0.0f, 0.0f, bounds.getWidth(), bounds.getHeight());
+ snapshot->height = bounds.getHeight();
snapshot->flags |= Snapshot::kFlagDirtyOrtho;
snapshot->orthoMatrix.load(mOrthoMatrix);
setScissorFromClip();
// Change the ortho projection
- glViewport(0, 0, right - left, bottom - top);
- mOrthoMatrix.loadOrtho(0.0f, right - left, bottom - top, 0.0f, -1.0f, 1.0f);
+ glViewport(0, 0, bounds.getWidth(), bounds.getHeight());
+ mOrthoMatrix.loadOrtho(0.0f, bounds.getWidth(), bounds.getHeight(), 0.0f, -1.0f, 1.0f);
return true;
}
@@ -323,8 +330,8 @@
glBindFramebuffer(GL_FRAMEBUFFER, previous->fbo);
// Restore the clip from the previous snapshot
- const Rect& clip = previous->clipRect;
- glScissor(clip.left, mHeight - clip.bottom, clip.getWidth(), clip.getHeight());
+ const Rect& clip = *previous->clipRect;
+ glScissor(clip.left, previous->height - clip.bottom, clip.getWidth(), clip.getHeight());
Layer* layer = current->layer;
const Rect& rect = layer->layer;
@@ -355,28 +362,28 @@
///////////////////////////////////////////////////////////////////////////////
void OpenGLRenderer::translate(float dx, float dy) {
- mSnapshot->transform.translate(dx, dy, 0.0f);
+ mSnapshot->transform->translate(dx, dy, 0.0f);
}
void OpenGLRenderer::rotate(float degrees) {
- mSnapshot->transform.rotate(degrees, 0.0f, 0.0f, 1.0f);
+ mSnapshot->transform->rotate(degrees, 0.0f, 0.0f, 1.0f);
}
void OpenGLRenderer::scale(float sx, float sy) {
- mSnapshot->transform.scale(sx, sy, 1.0f);
+ mSnapshot->transform->scale(sx, sy, 1.0f);
}
void OpenGLRenderer::setMatrix(SkMatrix* matrix) {
- mSnapshot->transform.load(*matrix);
+ mSnapshot->transform->load(*matrix);
}
void OpenGLRenderer::getMatrix(SkMatrix* matrix) {
- mSnapshot->transform.copyTo(*matrix);
+ mSnapshot->transform->copyTo(*matrix);
}
void OpenGLRenderer::concatMatrix(SkMatrix* matrix) {
mat4 m(*matrix);
- mSnapshot->transform.multiply(m);
+ mSnapshot->transform->multiply(m);
}
///////////////////////////////////////////////////////////////////////////////
@@ -384,7 +391,7 @@
///////////////////////////////////////////////////////////////////////////////
void OpenGLRenderer::setScissorFromClip() {
- const Rect& clip = mSnapshot->clipRect;
+ const Rect& clip = *mSnapshot->clipRect;
glScissor(clip.left, mSnapshot->height - clip.bottom, clip.getWidth(), clip.getHeight());
}
@@ -396,8 +403,8 @@
if (mSnapshot->invisible) return true;
Rect r(left, top, right, bottom);
- mSnapshot->transform.mapRect(r);
- return !mSnapshot->clipRect.intersects(r);
+ mSnapshot->transform->mapRect(r);
+ return !mSnapshot->clipRect->intersects(r);
}
bool OpenGLRenderer::clipRect(float left, float top, float right, float bottom, SkRegion::Op op) {
@@ -405,7 +412,7 @@
if (clipped) {
setScissorFromClip();
}
- return !mSnapshot->clipRect.isEmpty();
+ return !mSnapshot->clipRect->isEmpty();
}
///////////////////////////////////////////////////////////////////////////////
@@ -501,7 +508,7 @@
void OpenGLRenderer::drawColor(int color, SkXfermode::Mode mode) {
if (mSnapshot->invisible) return;
- const Rect& clip = mSnapshot->clipRect;
+ const Rect& clip = *mSnapshot->clipRect;
drawColorRect(clip.left, clip.top, clip.right, clip.bottom, color, mode, true);
}
@@ -538,7 +545,7 @@
float scaleX = paint->getTextScaleX();
bool applyScaleX = scaleX < 0.9999f || scaleX > 1.0001f;
if (applyScaleX) {
- save(0);
+ save(SkCanvas::kMatrix_SaveFlag);
translate(x - (x * scaleX), 0.0f);
scale(scaleX, 1.0f);
}
@@ -747,7 +754,7 @@
} else {
mModelView.loadIdentity();
}
- mCaches.currentProgram->set(mOrthoMatrix, mModelView, mSnapshot->transform);
+ mCaches.currentProgram->set(mOrthoMatrix, mModelView, *mSnapshot->transform);
glUniform4f(mCaches.currentProgram->color, r, g, b, a);
textureUnit++;
@@ -852,7 +859,7 @@
mModelView.loadTranslate(left, top, 0.0f);
mModelView.scale(right - left, bottom - top, 1.0f);
if (!ignoreTransform) {
- mCaches.currentProgram->set(mOrthoMatrix, mModelView, mSnapshot->transform);
+ mCaches.currentProgram->set(mOrthoMatrix, mModelView, *mSnapshot->transform);
} else {
mat4 identity;
mCaches.currentProgram->set(mOrthoMatrix, mModelView, identity);
@@ -900,7 +907,7 @@
mModelView.scale(right - left, bottom - top, 1.0f);
useProgram(mCaches.programCache.get(description));
- mCaches.currentProgram->set(mOrthoMatrix, mModelView, mSnapshot->transform);
+ mCaches.currentProgram->set(mOrthoMatrix, mModelView, *mSnapshot->transform);
chooseBlending(blend || alpha < 1.0f, mode);
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index d0e04b2..0e90d20 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -108,9 +108,11 @@
* The new snapshot is saved in mSnapshot and the previous snapshot
* is linked from mSnapshot->previous.
*
+ * @param flags The save flags; see SkCanvas for more information
+ *
* @return The new save count. This value can be passed to #restoreToCount()
*/
- int saveSnapshot();
+ int saveSnapshot(int flags);
/**
* Restores the current snapshot; mSnapshot becomes mSnapshot->previous.
diff --git a/libs/hwui/Rect.h b/libs/hwui/Rect.h
index 7be0c340..6b22c2b 100644
--- a/libs/hwui/Rect.h
+++ b/libs/hwui/Rect.h
@@ -91,11 +91,11 @@
set(r.left, r.top, r.right, r.bottom);
}
- float getWidth() const {
+ inline float getWidth() const {
return right - left;
}
- float getHeight() const {
+ inline float getHeight() const {
return bottom - top;
}
diff --git a/libs/hwui/SkiaShader.cpp b/libs/hwui/SkiaShader.cpp
index c7a01b1..a5e0f78 100644
--- a/libs/hwui/SkiaShader.cpp
+++ b/libs/hwui/SkiaShader.cpp
@@ -167,12 +167,12 @@
shaderMatrix.mapPoint(start.left, start.top);
shaderMatrix.mapPoint(start.right, start.bottom);
}
- snapshot.transform.mapRect(start);
+ snapshot.transform->mapRect(start);
const float gradientX = start.right - start.left;
const float gradientY = start.bottom - start.top;
- mat4 screenSpace(snapshot.transform);
+ mat4 screenSpace(*snapshot.transform);
screenSpace.multiply(modelView);
// Uniforms
diff --git a/libs/hwui/Snapshot.h b/libs/hwui/Snapshot.h
index 97e7cae..da48243 100644
--- a/libs/hwui/Snapshot.h
+++ b/libs/hwui/Snapshot.h
@@ -22,6 +22,7 @@
#include <utils/RefBase.h>
+#include <SkCanvas.h>
#include <SkRegion.h>
#include "Layer.h"
@@ -42,27 +43,40 @@
*/
class Snapshot: public LightRefBase<Snapshot> {
public:
- Snapshot(): invisible(false), flags(0), previous(NULL), layer(NULL), fbo(0) { }
+ Snapshot(): invisible(false), flags(0), previous(NULL), layer(NULL), fbo(0) {
+ transform = &mTransformRoot;
+ clipRect = &mClipRectRoot;
+ }
/**
- * Copies the specified snapshot. Only the transform and clip rectangle
- * are copied. The layer information is set to 0 and the transform is
- * assumed to be dirty. The specified snapshot is stored as the previous
- * snapshot.
+ * Copies the specified snapshot/ The specified snapshot is stored as
+ * the previous snapshot.
*/
- Snapshot(const sp<Snapshot>& s):
+ Snapshot(const sp<Snapshot>& s, int saveFlags):
height(s->height),
- transform(s->transform),
- clipRect(s->clipRect),
invisible(s->invisible),
flags(0),
previous(s),
layer(NULL),
fbo(s->fbo),
viewport(s->viewport) {
+ if (saveFlags & SkCanvas::kMatrix_SaveFlag) {
+ mTransformRoot.load(*s->transform);
+ transform = &mTransformRoot;
+ } else {
+ transform = s->transform;
+ }
+
+ if (saveFlags & SkCanvas::kClip_SaveFlag) {
+ mClipRectRoot.set(*s->clipRect);
+ clipRect = &mClipRectRoot;
+ } else {
+ clipRect = s->clipRect;
+ }
+
if ((s->flags & Snapshot::kFlagClipSet) &&
!(s->flags & Snapshot::kFlagDirtyLocalClip)) {
- localClip.set(s->localClip);
+ mLocalClip.set(s->mLocalClip);
} else {
flags |= Snapshot::kFlagDirtyLocalClip;
}
@@ -99,23 +113,23 @@
bool clipped = false;
Rect r(left, top, right, bottom);
- transform.mapRect(r);
+ transform->mapRect(r);
switch (op) {
case SkRegion::kDifference_Op:
break;
case SkRegion::kIntersect_Op:
- clipped = clipRect.intersect(r);
+ clipped = clipRect->intersect(r);
break;
case SkRegion::kUnion_Op:
- clipped = clipRect.unionWith(r);
+ clipped = clipRect->unionWith(r);
break;
case SkRegion::kXOR_Op:
break;
case SkRegion::kReverseDifference_Op:
break;
case SkRegion::kReplace_Op:
- clipRect.set(r);
+ clipRect->set(r);
clipped = true;
break;
}
@@ -131,21 +145,34 @@
* Sets the current clip.
*/
void setClip(float left, float top, float right, float bottom) {
- clipRect.set(left, top, right, bottom);
+ clipRect->set(left, top, right, bottom);
flags |= Snapshot::kFlagClipSet | Snapshot::kFlagDirtyLocalClip;
}
const Rect& getLocalClip() {
if (flags & Snapshot::kFlagDirtyLocalClip) {
mat4 inverse;
- inverse.loadInverse(transform);
+ inverse.loadInverse(*transform);
- localClip.set(clipRect);
- inverse.mapRect(localClip);
+ mLocalClip.set(*clipRect);
+ inverse.mapRect(mLocalClip);
flags &= ~Snapshot::kFlagDirtyLocalClip;
}
- return localClip;
+ return mLocalClip;
+ }
+
+ // TODO: Temporary
+ void resetTransform(float x, float y, float z) {
+ transform = &mTransformRoot;
+ transform->loadTranslate(x, y, z);
+ }
+
+ // TODO: Temporary
+ void resetClip(float left, float top, float right, float bottom) {
+ clipRect = &mClipRectRoot;
+ clipRect->set(left, top, right, bottom);
+ flags |= Snapshot::kFlagClipSet | Snapshot::kFlagDirtyLocalClip;
}
/**
@@ -154,18 +181,6 @@
int height;
/**
- * Local transformation. Holds the current translation, scale and
- * rotation values.
- */
- mat4 transform;
-
- /**
- * Current clip region. The clip is stored in canvas-space coordinates,
- * (screen-space coordinates in the regular case.)
- */
- Rect clipRect;
-
- /**
* If true, the layer won't be rendered.
*/
bool invisible;
@@ -196,8 +211,22 @@
*/
mat4 orthoMatrix;
+ /**
+ * Local transformation. Holds the current translation, scale and
+ * rotation values.
+ */
+ mat4* transform;
+
+ /**
+ * Current clip region. The clip is stored in canvas-space coordinates,
+ * (screen-space coordinates in the regular case.)
+ */
+ Rect* clipRect;
+
private:
- Rect localClip;
+ mat4 mTransformRoot;
+ Rect mClipRectRoot;
+ Rect mLocalClip;
}; // class Snapshot
diff --git a/libs/rs/rsProgramVertex.cpp b/libs/rs/rsProgramVertex.cpp
index e1628f4..68e3705 100644
--- a/libs/rs/rsProgramVertex.cpp
+++ b/libs/rs/rsProgramVertex.cpp
@@ -70,52 +70,7 @@
void ProgramVertex::setupGL(const Context *rsc, ProgramVertexState *state)
{
- if ((state->mLast.get() == this) && !mDirty) {
- return;
- }
- state->mLast.set(this);
-
- const float *f = static_cast<const float *>(mConstants[0]->getPtr());
-
- glMatrixMode(GL_TEXTURE);
- if (mTextureMatrixEnable) {
- glLoadMatrixf(&f[RS_PROGRAM_VERTEX_TEXTURE_OFFSET]);
- } else {
- glLoadIdentity();
- }
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- if (mLightCount) {
-#ifndef ANDROID_RS_BUILD_FOR_HOST // GLES Only
- int v = 0;
- glEnable(GL_LIGHTING);
-
- glLightModelxv(GL_LIGHT_MODEL_TWO_SIDE, &v);
-
- for (uint32_t ct = 0; ct < mLightCount; ct++) {
- const Light *l = mLights[ct].get();
- glEnable(GL_LIGHT0 + ct);
- l->setupGL(ct);
- }
- for (uint32_t ct = mLightCount; ct < MAX_LIGHTS; ct++) {
- glDisable(GL_LIGHT0 + ct);
- }
-#endif //ANDROID_RS_BUILD_FOR_HOST
- } else {
- glDisable(GL_LIGHTING);
- }
-
- if (!f) {
- LOGE("Must bind constants to vertex program");
- }
-
- glMatrixMode(GL_PROJECTION);
- glLoadMatrixf(&f[RS_PROGRAM_VERTEX_PROJECTION_OFFSET]);
- glMatrixMode(GL_MODELVIEW);
- glLoadMatrixf(&f[RS_PROGRAM_VERTEX_MODELVIEW_OFFSET]);
-
- mDirty = false;
+ assert(0);
}
void ProgramVertex::loadShader(Context *rsc) {
diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp
index 5a2b6ba..b4b32bb 100644
--- a/libs/rs/rsScriptC_Lib.cpp
+++ b/libs/rs/rsScriptC_Lib.cpp
@@ -18,7 +18,6 @@
#include "rsScriptC.h"
#include "rsMatrix.h"
-#include "acc/acc.h"
#include "utils/Timers.h"
#include <time.h>
diff --git a/libs/rs/rsScriptC_LibGL.cpp b/libs/rs/rsScriptC_LibGL.cpp
index a7877cdb..2f8f79a 100644
--- a/libs/rs/rsScriptC_LibGL.cpp
+++ b/libs/rs/rsScriptC_LibGL.cpp
@@ -18,7 +18,6 @@
#include "rsScriptC.h"
#include "rsMatrix.h"
-#include "acc/acc.h"
#include "utils/Timers.h"
#define GL_GLEXT_PROTOTYPES
diff --git a/media/jni/Android.mk b/media/jni/Android.mk
index 653532c..25d243b 100644
--- a/media/jni/Android.mk
+++ b/media/jni/Android.mk
@@ -1,10 +1,6 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
-ifneq ($(BUILD_WITHOUT_PV),true)
-include external/opencore/Config.mk
-endif
-
LOCAL_SRC_FILES:= \
android_media_MediaPlayer.cpp \
android_media_MediaRecorder.cpp \
@@ -32,14 +28,6 @@
libcamera_client \
libsqlite
-ifneq ($(BUILD_WITHOUT_PV),true)
-
-LOCAL_SHARED_LIBRARIES += \
- libopencore_player
-else
- LOCAL_CFLAGS += -DNO_OPENCORE
-endif
-
ifneq ($(TARGET_SIMULATOR),true)
LOCAL_STATIC_LIBRARIES := libmtp libusbhost
endif
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 6710db0..d4aacaf 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -792,10 +792,7 @@
extern int register_android_media_MtpCursor(JNIEnv *env);
extern int register_android_media_MtpDatabase(JNIEnv *env);
extern int register_android_media_MtpServer(JNIEnv *env);
-
-#ifndef NO_OPENCORE
extern int register_android_media_AmrInputStream(JNIEnv *env);
-#endif
jint JNI_OnLoad(JavaVM* vm, void* reserved)
{
@@ -828,12 +825,10 @@
goto bail;
}
-#ifndef NO_OPENCORE
if (register_android_media_AmrInputStream(env) < 0) {
LOGE("ERROR: AmrInputStream native registration failed\n");
goto bail;
}
-#endif
if (register_android_media_ResampleInputStream(env) < 0) {
LOGE("ERROR: ResampleInputStream native registration failed\n");
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index bbbf45c..f1b8334 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -24,6 +24,7 @@
#include <media/stagefright/AudioSource.h>
#include <media/stagefright/AMRWriter.h>
#include <media/stagefright/CameraSource.h>
+#include <media/stagefright/VideoSourceDownSampler.h>
#include <media/stagefright/CameraSourceTimeLapse.h>
#include <media/stagefright/MediaSourceSplitter.h>
#include <media/stagefright/MPEG4Writer.h>
@@ -532,6 +533,42 @@
return OK;
}
+status_t StagefrightRecorder::setParamAuxVideoWidth(int32_t width) {
+ LOGV("setParamAuxVideoWidth : %d", width);
+
+ if (width <= 0) {
+ LOGE("Width (%d) is not positive", width);
+ return BAD_VALUE;
+ }
+
+ mAuxVideoWidth = width;
+ return OK;
+}
+
+status_t StagefrightRecorder::setParamAuxVideoHeight(int32_t height) {
+ LOGV("setParamAuxVideoHeight : %d", height);
+
+ if (height <= 0) {
+ LOGE("Height (%d) is not positive", height);
+ return BAD_VALUE;
+ }
+
+ mAuxVideoHeight = height;
+ return OK;
+}
+
+status_t StagefrightRecorder::setParamAuxVideoEncodingBitRate(int32_t bitRate) {
+ LOGV("StagefrightRecorder::setParamAuxVideoEncodingBitRate: %d", bitRate);
+
+ if (bitRate <= 0) {
+ LOGE("Invalid video encoding bit rate: %d", bitRate);
+ return BAD_VALUE;
+ }
+
+ mAuxVideoBitRate = bitRate;
+ return OK;
+}
+
status_t StagefrightRecorder::setParameter(
const String8 &key, const String8 &value) {
LOGV("setParameter: key (%s) => value (%s)", key.string(), value.string());
@@ -631,6 +668,21 @@
return setParamTimeBetweenTimeLapseFrameCapture(
1000LL * timeBetweenTimeLapseFrameCaptureMs);
}
+ } else if (key == "video-aux-param-width") {
+ int32_t auxWidth;
+ if (safe_strtoi32(value.string(), &auxWidth)) {
+ return setParamAuxVideoWidth(auxWidth);
+ }
+ } else if (key == "video-aux-param-height") {
+ int32_t auxHeight;
+ if (safe_strtoi32(value.string(), &auxHeight)) {
+ return setParamAuxVideoHeight(auxHeight);
+ }
+ } else if (key == "video-aux-param-encoding-bitrate") {
+ int32_t auxVideoBitRate;
+ if (safe_strtoi32(value.string(), &auxVideoBitRate)) {
+ return setParamAuxVideoEncodingBitRate(auxVideoBitRate);
+ }
} else {
LOGE("setParameter: failed to find key %s", key.string());
}
@@ -1079,6 +1131,13 @@
}
if (mVideoEncoderLevel != -1) {
enc_meta->setInt32(kKeyVideoLevel, mVideoEncoderLevel);
+ } else if (mCaptureTimeLapse) {
+ // Check if we are using high resolution and/or high bitrate and
+ // set appropriate level for the software AVCEncoder.
+ if ((width * height >= 921600) // 720p
+ || (videoBitRate >= 20000000)) {
+ enc_meta->setInt32(kKeyVideoLevel, 50);
+ }
}
OMXClient client;
@@ -1122,7 +1181,9 @@
status_t StagefrightRecorder::setupMPEG4Recording(
bool useSplitCameraSource,
- int outputFd, int32_t audioBitRate, int32_t videoBitRate,
+ int outputFd,
+ int32_t videoWidth, int32_t videoHeight,
+ int32_t videoBitRate,
int32_t *totalBitRate,
sp<MediaWriter> *mediaWriter) {
mediaWriter->clear();
@@ -1134,7 +1195,7 @@
if (!mCaptureTimeLapse && (mAudioSource != AUDIO_SOURCE_LIST_END)) {
err = setupAudioEncoder(writer);
if (err != OK) return err;
- *totalBitRate += audioBitRate;
+ *totalBitRate += mAudioBitRate;
}
if (mVideoSource == VIDEO_SOURCE_DEFAULT
|| mVideoSource == VIDEO_SOURCE_CAMERA) {
@@ -1148,6 +1209,13 @@
err = setupCameraSource(&cameraSource);
cameraMediaSource = cameraSource;
}
+ if ((videoWidth != mVideoWidth) || (videoHeight != mVideoHeight)) {
+ // Use downsampling from the original source.
+ CHECK(videoWidth <= mVideoWidth);
+ CHECK(videoHeight <= mVideoHeight);
+ cameraMediaSource =
+ new VideoSourceDownSampler(cameraMediaSource, videoWidth, videoHeight);
+ }
if (err != OK) {
return err;
}
@@ -1207,7 +1275,8 @@
int32_t totalBitRate;
status_t err = setupMPEG4Recording(mCaptureAuxVideo,
- mOutputFd, mAudioBitRate, mVideoBitRate, &totalBitRate, &mWriter);
+ mOutputFd, mVideoWidth, mVideoHeight,
+ mVideoBitRate, &totalBitRate, &mWriter);
if (err != OK) {
return err;
}
@@ -1230,7 +1299,8 @@
int32_t totalBitrateAux;
err = setupMPEG4Recording(mCaptureAuxVideo,
- mOutputFdAux, mAudioBitRateAux, mVideoBitRateAux, &totalBitrateAux, &mWriterAux);
+ mOutputFdAux, mAuxVideoWidth, mAuxVideoHeight,
+ mAuxVideoBitRate, &totalBitrateAux, &mWriterAux);
if (err != OK) {
return err;
}
@@ -1326,13 +1396,14 @@
mVideoEncoder = VIDEO_ENCODER_H263;
mVideoWidth = 176;
mVideoHeight = 144;
+ mAuxVideoWidth = 176;
+ mAuxVideoHeight = 144;
mFrameRate = 20;
mVideoBitRate = 192000;
- mVideoBitRateAux = 20000000;
+ mAuxVideoBitRate = 192000;
mSampleRate = 8000;
mAudioChannels = 1;
mAudioBitRate = 12200;
- mAudioBitRateAux = 12200;
mInterleaveDurationUs = 0;
mIFramesIntervalSec = 1;
mAudioSourceNode = 0;
@@ -1414,8 +1485,6 @@
result.append(buffer);
snprintf(buffer, SIZE, " Bit rate (bps): %d\n", mAudioBitRate);
result.append(buffer);
- snprintf(buffer, SIZE, " Bit rate auxiliary (bps): %d\n", mAudioBitRateAux);
- result.append(buffer);
snprintf(buffer, SIZE, " Sampling rate (hz): %d\n", mSampleRate);
result.append(buffer);
snprintf(buffer, SIZE, " Number of channels: %d\n", mAudioChannels);
@@ -1440,11 +1509,13 @@
result.append(buffer);
snprintf(buffer, SIZE, " Frame size (pixels): %dx%d\n", mVideoWidth, mVideoHeight);
result.append(buffer);
+ snprintf(buffer, SIZE, " Aux Frame size (pixels): %dx%d\n", mAuxVideoWidth, mAuxVideoHeight);
+ result.append(buffer);
snprintf(buffer, SIZE, " Frame rate (fps): %d\n", mFrameRate);
result.append(buffer);
snprintf(buffer, SIZE, " Bit rate (bps): %d\n", mVideoBitRate);
result.append(buffer);
- snprintf(buffer, SIZE, " Bit rate Auxiliary (bps): %d\n", mVideoBitRateAux);
+ snprintf(buffer, SIZE, " Aux Bit rate (bps): %d\n", mAuxVideoBitRate);
result.append(buffer);
::write(fd, result.string(), result.size());
return OK;
diff --git a/media/libmediaplayerservice/StagefrightRecorder.h b/media/libmediaplayerservice/StagefrightRecorder.h
index d75a540..d50a393 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.h
+++ b/media/libmediaplayerservice/StagefrightRecorder.h
@@ -79,9 +79,10 @@
video_encoder mVideoEncoder;
bool mUse64BitFileOffset;
int32_t mVideoWidth, mVideoHeight;
+ int32_t mAuxVideoWidth, mAuxVideoHeight;
int32_t mFrameRate;
- int32_t mVideoBitRate, mVideoBitRateAux;
- int32_t mAudioBitRate, mAudioBitRateAux;
+ int32_t mVideoBitRate, mAuxVideoBitRate;
+ int32_t mAudioBitRate;
int32_t mAudioChannels;
int32_t mSampleRate;
int32_t mInterleaveDurationUs;
@@ -109,8 +110,10 @@
MediaProfiles *mEncoderProfiles;
status_t setupMPEG4Recording(
- bool useAuxiliaryCameraSource,
- int outputFd, int32_t audioBitRate, int32_t videoBitRate,
+ bool useSplitCameraSource,
+ int outputFd,
+ int32_t videoWidth, int32_t videoHeight,
+ int32_t videoBitRate,
int32_t *totalBitRate,
sp<MediaWriter> *mediaWriter);
void setupMPEG4MetaData(int64_t startTimeUs, int32_t totalBitRate,
@@ -137,6 +140,9 @@
status_t setParamTimeLapseEnable(int32_t timeLapseEnable);
status_t setParamUseStillCameraForTimeLapse(int32_t useStillCamera);
status_t setParamTimeBetweenTimeLapseFrameCapture(int64_t timeUs);
+ status_t setParamAuxVideoHeight(int32_t height);
+ status_t setParamAuxVideoWidth(int32_t width);
+ status_t setParamAuxVideoEncodingBitRate(int32_t bitRate);
status_t setParamVideoEncodingBitRate(int32_t bitRate);
status_t setParamVideoIFramesInterval(int32_t seconds);
status_t setParamVideoEncoderProfile(int32_t profile);
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp
index 4c729e4..bcae913 100644
--- a/media/libstagefright/AudioSource.cpp
+++ b/media/libstagefright/AudioSource.cpp
@@ -72,6 +72,10 @@
return UNKNOWN_ERROR;
}
+ if (mInitCheck != OK) {
+ return NO_INIT;
+ }
+
char value[PROPERTY_VALUE_MAX];
if (property_get("media.stagefright.record-stats", value, NULL)
&& (!strcmp(value, "1") || !strcasecmp(value, "true"))) {
@@ -102,6 +106,10 @@
return UNKNOWN_ERROR;
}
+ if (mInitCheck != OK) {
+ return NO_INIT;
+ }
+
mRecord->stop();
delete mGroup;
@@ -118,6 +126,10 @@
}
sp<MetaData> AudioSource::getFormat() {
+ if (mInitCheck != OK) {
+ return 0;
+ }
+
sp<MetaData> meta = new MetaData;
meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_RAW);
meta->setInt32(kKeySampleRate, mRecord->getSampleRate());
@@ -193,6 +205,11 @@
status_t AudioSource::read(
MediaBuffer **out, const ReadOptions *options) {
+
+ if (mInitCheck != OK) {
+ return NO_INIT;
+ }
+
*out = NULL;
MediaBuffer *buffer;
@@ -294,10 +311,6 @@
buffer->meta_data()->setInt64(kKeyTime, mPrevSampleTimeUs);
CHECK(timestampUs > mPrevSampleTimeUs);
- if (mTotalLostFrames == 0) {
- CHECK_EQ(mPrevSampleTimeUs,
- mStartTimeUs + (1000000LL * numFramesRecorded) / sampleRate);
- }
mPrevSampleTimeUs = timestampUs;
LOGV("initial delay: %lld, sample rate: %d, timestamp: %lld",
mStartTimeUs, sampleRate, timestampUs);
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 085e92d..e78a616 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -274,9 +274,13 @@
status_t AwesomePlayer::setDataSource(
int fd, int64_t offset, int64_t length) {
#if 0
+ // return setDataSource("httplive://qthttp.apple.com.edgesuite.net/1009qpeijrfn/sl.m3u8");
+ return setDataSource("httplive://qthttp.apple.com.edgesuite.net/1009qpeijrfn/0440.m3u8");
+ // return setDataSource("httplive://qthttp.apple.com.edgesuite.net/1009qpeijrfn/0640.m3u8");
+ // return setDataSource("httplive://qthttp.apple.com.edgesuite.net/1009qpeijrfn/1240_vod.m3u8");
// return setDataSource("httplive://iphoned5.akamai.com.edgesuite.net/mhbarron/nasatv/nasatv_96.m3u8");
// return setDataSource("httplive://iphoned5.akamai.com.edgesuite.net/mhbarron/nasatv/nasatv_1500.m3u8");
- return setDataSource("httplive://iphone.video.hsn.com/iPhone_high.m3u8");
+ // return setDataSource("httplive://iphone.video.hsn.com/iPhone_high.m3u8");
// return setDataSource("httplive://iphoned5.akamai.com.edgesuite.net/mhbarron/iphonewebcast/webcast090209_all/webcast090209_all.m3u8");
// return setDataSource("httplive://qthttp.akamai.com.edgesuite.net/iphone_demo/Video_Content/usat/tt_062209_iphone/hi/prog_index.m3u8");
// return setDataSource("httplive://qthttp.akamai.com.edgesuite.net/iphone_demo/Video_Content/usat/tt_googmaps/hi/prog_index.m3u8");
@@ -456,6 +460,33 @@
}
mBufferingEventPending = false;
+ int kLowWaterMarkSecs = 2;
+ int kHighWaterMarkSecs = 10;
+
+ if (mRTSPController != NULL) {
+ bool eos;
+ int64_t queueDurationUs = mRTSPController->getQueueDurationUs(&eos);
+
+ LOGV("queueDurationUs = %.2f secs", queueDurationUs / 1E6);
+
+ if ((mFlags & PLAYING) && !eos
+ && (queueDurationUs < kLowWaterMarkSecs * 1000000ll)) {
+ LOGI("rtsp cache is running low, pausing.");
+ mFlags |= CACHE_UNDERRUN;
+ pause_l();
+ notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_START);
+ } else if ((mFlags & CACHE_UNDERRUN)
+ && (eos || queueDurationUs > kHighWaterMarkSecs * 1000000ll)) {
+ LOGI("rtsp cache has filled up, resuming.");
+ mFlags &= ~CACHE_UNDERRUN;
+ play_l();
+ notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_END);
+ }
+
+ postBufferingEvent_l();
+ return;
+ }
+
if (mCachedSource == NULL) {
return;
}
@@ -483,8 +514,8 @@
notifyListener_l(MEDIA_BUFFERING_UPDATE, percentage);
- lowWatermark = 2 * bitrate / 8; // 2 secs
- highWatermark = 10 * bitrate / 8; // 10 secs
+ lowWatermark = kLowWaterMarkSecs * bitrate / 8;
+ highWatermark = kHighWaterMarkSecs * bitrate / 8;
}
}
diff --git a/media/libstagefright/include/ARTSPController.h b/media/libstagefright/include/ARTSPController.h
index 7016880..300d8f7 100644
--- a/media/libstagefright/include/ARTSPController.h
+++ b/media/libstagefright/include/ARTSPController.h
@@ -42,6 +42,7 @@
size_t index, uint32_t flags);
int64_t getNormalPlayTimeUs();
+ int64_t getQueueDurationUs(bool *eos);
void onMessageReceived(const sp<AMessage> &msg);
diff --git a/media/libstagefright/mpeg2ts/ATSParser.cpp b/media/libstagefright/mpeg2ts/ATSParser.cpp
index 26a0fb3..72de8d7 100644
--- a/media/libstagefright/mpeg2ts/ATSParser.cpp
+++ b/media/libstagefright/mpeg2ts/ATSParser.cpp
@@ -78,6 +78,8 @@
unsigned PTS_DTS_flags, uint64_t PTS, uint64_t DTS,
const uint8_t *data, size_t size);
+ void extractAACFrames(const sp<ABuffer> &buffer);
+
DISALLOW_EVIL_CONSTRUCTORS(Stream);
};
@@ -226,7 +228,7 @@
ATSParser::Stream::Stream(unsigned elementaryPID, unsigned streamType)
: mElementaryPID(elementaryPID),
mStreamType(streamType),
- mBuffer(new ABuffer(65536)),
+ mBuffer(new ABuffer(128 * 1024)),
mPayloadStarted(false) {
mBuffer->setRange(0, 0);
}
@@ -662,7 +664,7 @@
csd->data()[sizeof(kStaticESDS) + 1] =
((sampling_freq_index << 7) & 0x80) | (channel_configuration << 3);
- hexdump(csd->data(), csd->size());
+ // hexdump(csd->data(), csd->size());
return csd;
}
@@ -727,13 +729,76 @@
buffer->meta()->setInt64("time", (PTS * 100) / 9);
if (mStreamType == 0x0f) {
- // WHY???
- buffer->setRange(7, buffer->size() - 7);
+ extractAACFrames(buffer);
}
mSource->queueAccessUnit(buffer);
}
+// Disassemble one or more ADTS frames into their constituent parts and
+// leave only the concatenated raw_data_blocks in the buffer.
+void ATSParser::Stream::extractAACFrames(const sp<ABuffer> &buffer) {
+ size_t dstOffset = 0;
+
+ size_t offset = 0;
+ while (offset < buffer->size()) {
+ CHECK_LE(offset + 7, buffer->size());
+
+ ABitReader bits(buffer->data() + offset, buffer->size() - offset);
+
+ // adts_fixed_header
+
+ CHECK_EQ(bits.getBits(12), 0xfffu);
+ bits.skipBits(3); // ID, layer
+ bool protection_absent = bits.getBits(1) != 0;
+
+ // profile_ObjectType, sampling_frequency_index, private_bits,
+ // channel_configuration, original_copy, home
+ bits.skipBits(12);
+
+ // adts_variable_header
+
+ // copyright_identification_bit, copyright_identification_start
+ bits.skipBits(2);
+
+ unsigned aac_frame_length = bits.getBits(13);
+
+ bits.skipBits(11); // adts_buffer_fullness
+
+ unsigned number_of_raw_data_blocks_in_frame = bits.getBits(2);
+
+ if (number_of_raw_data_blocks_in_frame == 0) {
+ size_t scan = offset + aac_frame_length;
+
+ offset += 7;
+ if (!protection_absent) {
+ offset += 2;
+ }
+
+ CHECK_LE(scan, buffer->size());
+
+ LOG(VERBOSE)
+ << "found aac raw data block at ["
+ << StringPrintf("0x%08x", offset)
+ << " ; "
+ << StringPrintf("0x%08x", scan)
+ << ")";
+
+ memmove(&buffer->data()[dstOffset], &buffer->data()[offset],
+ scan - offset);
+
+ dstOffset += scan - offset;
+ offset = scan;
+ } else {
+ // To be implemented.
+ TRESPASS();
+ }
+ }
+ CHECK_EQ(offset, buffer->size());
+
+ buffer->setRange(buffer->offset(), dstOffset);
+}
+
sp<MediaSource> ATSParser::Stream::getSource(SourceType type) {
if ((type == AVC_VIDEO && mStreamType == 0x1b)
|| (type == MPEG2ADTS_AUDIO && mStreamType == 0x0f)) {
diff --git a/media/libstagefright/rtsp/APacketSource.cpp b/media/libstagefright/rtsp/APacketSource.cpp
index 75b4571..b63798f 100644
--- a/media/libstagefright/rtsp/APacketSource.cpp
+++ b/media/libstagefright/rtsp/APacketSource.cpp
@@ -746,4 +746,27 @@
mNormalPlayTimeBaseUs = normalPlayTimeUs;
}
+int64_t APacketSource::getQueueDurationUs(bool *eos) {
+ Mutex::Autolock autoLock(mLock);
+
+ *eos = (mEOSResult != OK);
+
+ if (mBuffers.size() < 2) {
+ return 0;
+ }
+
+ const sp<ABuffer> first = *mBuffers.begin();
+ const sp<ABuffer> last = *--mBuffers.end();
+
+ int64_t firstTimeUs;
+ CHECK(first->meta()->findInt64("timeUs", &firstTimeUs));
+
+ int64_t lastTimeUs;
+ CHECK(last->meta()->findInt64("timeUs", &lastTimeUs));
+
+ CHECK_GE(lastTimeUs, firstTimeUs);
+
+ return lastTimeUs - firstTimeUs;
+}
+
} // namespace android
diff --git a/media/libstagefright/rtsp/APacketSource.h b/media/libstagefright/rtsp/APacketSource.h
index 3833ab1..076ddc47 100644
--- a/media/libstagefright/rtsp/APacketSource.h
+++ b/media/libstagefright/rtsp/APacketSource.h
@@ -50,6 +50,8 @@
void setNormalPlayTimeMapping(
uint32_t rtpTime, int64_t normalPlayTimeUs);
+ int64_t getQueueDurationUs(bool *eos);
+
protected:
virtual ~APacketSource();
diff --git a/media/libstagefright/rtsp/ARTPSession.cpp b/media/libstagefright/rtsp/ARTPSession.cpp
index f60c1a9..8ce93b7 100644
--- a/media/libstagefright/rtsp/ARTPSession.cpp
+++ b/media/libstagefright/rtsp/ARTPSession.cpp
@@ -125,6 +125,14 @@
switch (msg->what()) {
case kWhatAccessUnitComplete:
{
+ int32_t firstRTCP;
+ if (msg->findInt32("first-rtcp", &firstRTCP)) {
+ // There won't be an access unit here, it's just a notification
+ // that the data communication worked since we got the first
+ // rtcp packet.
+ break;
+ }
+
size_t trackIndex;
CHECK(msg->findSize("track-index", &trackIndex));
diff --git a/media/libstagefright/rtsp/ARTSPController.cpp b/media/libstagefright/rtsp/ARTSPController.cpp
index a89946b..4c53639 100644
--- a/media/libstagefright/rtsp/ARTSPController.cpp
+++ b/media/libstagefright/rtsp/ARTSPController.cpp
@@ -143,4 +143,26 @@
return mHandler->getNormalPlayTimeUs();
}
+int64_t ARTSPController::getQueueDurationUs(bool *eos) {
+ *eos = true;
+
+ int64_t minQueuedDurationUs = 0;
+ for (size_t i = 0; i < mHandler->countTracks(); ++i) {
+ sp<APacketSource> source = mHandler->getPacketSource(i);
+
+ bool newEOS;
+ int64_t queuedDurationUs = source->getQueueDurationUs(&newEOS);
+
+ if (!newEOS) {
+ *eos = false;
+ }
+
+ if (i == 0 || queuedDurationUs < minQueuedDurationUs) {
+ minQueuedDurationUs = queuedDurationUs;
+ }
+ }
+
+ return minQueuedDurationUs;
+}
+
} // namespace android
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index 88203c3..d19f318 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -16,6 +16,8 @@
package com.android.internal.policy.impl;
+import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
+
import com.android.internal.telephony.IccCard;
import com.android.internal.widget.LockPatternUtils;
@@ -41,6 +43,7 @@
import android.os.SystemClock;
import android.os.SystemProperties;
import android.provider.Settings;
+import android.provider.Settings.SettingNotFoundException;
import android.telephony.TelephonyManager;
import android.util.Config;
import android.util.EventLog;
@@ -93,6 +96,7 @@
*/
public class KeyguardViewMediator implements KeyguardViewCallback,
KeyguardUpdateMonitor.SimStateCallback {
+ private static final int KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT = 30000;
private final static boolean DEBUG = false && Config.LOGD;
private final static boolean DBG_WAKE = DEBUG || true;
@@ -133,7 +137,7 @@
* turning on the keyguard (i.e, the user has this much time to turn
* the screen back on without having to face the keyguard).
*/
- private static final int KEYGUARD_DELAY_MS = 5000;
+ private static final int KEYGUARD_LOCK_AFTER_DELAY_DEFAULT = 5000;
/**
* How long we'll wait for the {@link KeyguardViewCallback#keyguardDoneDrawing()}
@@ -244,6 +248,7 @@
* the keyguard.
*/
private boolean mWaitingUntilKeyguardVisible = false;
+ private LockPatternUtils mLockPatternUtils;
public KeyguardViewMediator(Context context, PhoneWindowManager callback,
LocalPowerManager powerManager) {
@@ -275,8 +280,9 @@
mUpdateMonitor.registerSimStateCallback(this);
- mKeyguardViewProperties = new LockPatternKeyguardViewProperties(
- new LockPatternUtils(mContext), mUpdateMonitor);
+ mLockPatternUtils = new LockPatternUtils(mContext);
+ mKeyguardViewProperties
+ = new LockPatternKeyguardViewProperties(mLockPatternUtils, mUpdateMonitor);
mKeyguardViewManager = new KeyguardViewManager(
context, WindowManagerImpl.getDefault(), this,
@@ -326,15 +332,46 @@
// to enable it a little bit later (i.e, give the user a chance
// to turn the screen back on within a certain window without
// having to unlock the screen)
- long when = SystemClock.elapsedRealtime() + KEYGUARD_DELAY_MS;
- Intent intent = new Intent(DELAYED_KEYGUARD_ACTION);
- intent.putExtra("seq", mDelayedShowingSequence);
- PendingIntent sender = PendingIntent.getBroadcast(mContext,
- 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
- mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, when,
- sender);
- if (DEBUG) Log.d(TAG, "setting alarm to turn off keyguard, seq = "
- + mDelayedShowingSequence);
+ final ContentResolver cr = mContext.getContentResolver();
+
+ // From DisplaySettings
+ long displayTimeout = Settings.System.getInt(cr, SCREEN_OFF_TIMEOUT,
+ KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT);
+
+ // From SecuritySettings
+ final long lockAfterTimeout = Settings.Secure.getInt(cr,
+ Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT,
+ KEYGUARD_LOCK_AFTER_DELAY_DEFAULT);
+
+ // From DevicePolicyAdmin
+ final long policyTimeout = mLockPatternUtils.getDevicePolicyManager()
+ .getMaximumTimeToLock(null);
+
+ long timeout;
+ if (policyTimeout > 0) {
+ // policy in effect. Make sure we don't go beyond policy limit.
+ displayTimeout = Math.max(displayTimeout, 0); // ignore negative values
+ timeout = Math.min(policyTimeout - displayTimeout, lockAfterTimeout);
+ } else {
+ timeout = lockAfterTimeout;
+ }
+
+ if (timeout <= 0) {
+ // Lock now
+ mSuppressNextLockSound = true;
+ doKeyguard();
+ } else {
+ // Lock in the future
+ long when = SystemClock.elapsedRealtime() + timeout;
+ Intent intent = new Intent(DELAYED_KEYGUARD_ACTION);
+ intent.putExtra("seq", mDelayedShowingSequence);
+ PendingIntent sender = PendingIntent.getBroadcast(mContext,
+ 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
+ mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, when,
+ sender);
+ if (DEBUG) Log.d(TAG, "setting alarm to turn off keyguard, seq = "
+ + mDelayedShowingSequence);
+ }
} else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_PROX_SENSOR) {
// Do not enable the keyguard if the prox sensor forced the screen off.
} else {
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 6f23805..c28a3733 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -121,6 +121,8 @@
private int mNetTransitionWakeLockSerialNumber;
private int mNetTransitionWakeLockTimeout;
+ private InetAddress mDefaultDns;
+
private static class NetworkAttributes {
/**
* Class for holding settings read from resources.
@@ -210,6 +212,19 @@
SystemProperties.set("net.hostname", name);
}
+ // read our default dns server ip
+ String dns = Settings.Secure.getString(context.getContentResolver(),
+ Settings.Secure.DEFAULT_DNS_SERVER);
+ if (dns == null || dns.length() == 0) {
+ dns = context.getResources().getString(
+ com.android.internal.R.string.config_default_dns_server);
+ }
+ try {
+ mDefaultDns = InetAddress.getByName(dns);
+ } catch (UnknownHostException e) {
+ Slog.e(TAG, "Error setting defaultDns using " + dns);
+ }
+
mContext = context;
PowerManager powerManager = (PowerManager)mContext.getSystemService(Context.POWER_SERVICE);
@@ -1469,12 +1484,20 @@
Collection<InetAddress> dnses = p.getDnses();
if (mNetAttributes[netType].isDefault()) {
int j = 1;
- for (InetAddress dns : dnses) {
+ if (dnses.size() == 0 && mDefaultDns != null) {
if (DBG) {
- Slog.d(TAG, "adding dns " + dns + " for " +
- nt.getNetworkInfo().getTypeName());
+ Slog.d(TAG, "no dns provided - using " + mDefaultDns.getHostAddress());
}
- SystemProperties.set("net.dns" + j++, dns.getHostAddress());
+ SystemProperties.set("net.dns1", mDefaultDns.getHostAddress());
+ j++;
+ } else {
+ for (InetAddress dns : dnses) {
+ if (DBG) {
+ Slog.d(TAG, "adding dns " + dns + " for " +
+ nt.getNetworkInfo().getTypeName());
+ }
+ SystemProperties.set("net.dns" + j++, dns.getHostAddress());
+ }
}
for (int k=j ; k<mNumDnsEntries; k++) {
if (DBG) Slog.d(TAG, "erasing net.dns" + k);
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 1bfeb79..1d57738 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -2603,7 +2603,7 @@
}
// First check if this is a system package that may involve an update
if (updatedPkg != null && (parseFlags&PackageParser.PARSE_IS_SYSTEM) != 0) {
- if (!ps.codePath.equals(scanFile)) {
+ if (ps != null && !ps.codePath.equals(scanFile)) {
// The path has changed from what was last scanned... check the
// version of the new path against what we have stored to determine
// what to do.
@@ -6181,18 +6181,15 @@
}
// Delete the updated package
outInfo.isRemovedPackageSystemUpdate = true;
- boolean deleteCodeAndResources = false;
- if (ps.versionCode < p.mVersionCode) {
+ final boolean deleteCodeAndResources;
+ if (ps.versionCode < p.mVersionCode) {
// Delete code and resources for downgrades
deleteCodeAndResources = true;
- if ((flags & PackageManager.DONT_DELETE_DATA) == 0) {
- flags &= ~PackageManager.DONT_DELETE_DATA;
- }
+ flags &= ~PackageManager.DONT_DELETE_DATA;
} else {
// Preserve data by setting flag
- if ((flags & PackageManager.DONT_DELETE_DATA) == 0) {
- flags |= PackageManager.DONT_DELETE_DATA;
- }
+ deleteCodeAndResources = false;
+ flags |= PackageManager.DONT_DELETE_DATA;
}
boolean ret = deleteInstalledPackageLI(p, deleteCodeAndResources, flags, outInfo);
if (!ret) {
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 16f3f10..2e32e60 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -2456,7 +2456,8 @@
}
mKeylightDelay = LONG_KEYLIGHT_DELAY;
if (totalDelay < 0) {
- mScreenOffDelay = Integer.MAX_VALUE;
+ // negative number means stay on as long as possible.
+ mScreenOffDelay = mMaximumScreenOffTimeout;
} else if (mKeylightDelay < totalDelay) {
// subtract the time that the keylight delay. This will give us the
// remainder of the time that we need to sleep to get the accurate
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index d44ce97..dffc31c 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -431,8 +431,11 @@
}
try {
- Slog.i(TAG, "Sip Service");
- ServiceManager.addService("sip", new SipService(context));
+ SipService sipService = SipService.create(context);
+ if (sipService != null) {
+ Slog.i(TAG, "Sip Service");
+ ServiceManager.addService("sip", sipService);
+ }
} catch (Throwable e) {
Slog.e(TAG, "Failure starting SIP Service", e);
}
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index c21a221..5f79b85 100644
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -2885,7 +2885,8 @@
+ " res=" + resultCode + " data=" + resultData);
if (r.info.applicationInfo.uid > 0) {
mService.grantUriPermissionFromIntentLocked(r.info.applicationInfo.uid,
- r.packageName, resultData, r.getUriPermissionsLocked());
+ resultTo.packageName, resultData,
+ resultTo.getUriPermissionsLocked());
}
resultTo.addResultLocked(r, r.resultWho, r.requestCode, resultCode,
resultData);
diff --git a/services/java/com/android/server/sip/SipService.java b/services/java/com/android/server/sip/SipService.java
index 3dcaff6..626b488 100644
--- a/services/java/com/android/server/sip/SipService.java
+++ b/services/java/com/android/server/sip/SipService.java
@@ -53,8 +53,6 @@
import java.util.TreeSet;
import javax.sip.SipException;
-/**
- */
public final class SipService extends ISipService.Stub {
private static final String TAG = "SipService";
private static final int EXPIRY_TIME = 3600;
@@ -78,7 +76,16 @@
private ConnectivityReceiver mConnectivityReceiver;
- public SipService(Context context) {
+ /**
+ * Creates a {@code SipService} instance. Returns null if SIP API is not
+ * supported.
+ */
+ public static SipService create(Context context) {
+ return (SipManager.isApiSupported(context) ? new SipService(context)
+ : null);
+ }
+
+ private SipService(Context context) {
Log.v(TAG, " service started!");
mContext = context;
mConnectivityReceiver = new ConnectivityReceiver();
diff --git a/tests/DumpRenderTree2/res/menu/gui_menu.xml b/tests/DumpRenderTree2/res/menu/gui_menu.xml
new file mode 100644
index 0000000..a5b2b65
--- /dev/null
+++ b/tests/DumpRenderTree2/res/menu/gui_menu.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2010 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.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/run_all"
+ android:title="@string/run_all_tests" />
+</menu>
\ No newline at end of file
diff --git a/tests/DumpRenderTree2/res/values/strings.xml b/tests/DumpRenderTree2/res/values/strings.xml
index 5fd1eb9..0496404 100644
--- a/tests/DumpRenderTree2/res/values/strings.xml
+++ b/tests/DumpRenderTree2/res/values/strings.xml
@@ -25,4 +25,6 @@
<string name="dialog_progress_msg">Please wait...</string>
<string name="runner_preloading_title">Preloading tests...</string>
+
+ <string name="run_all_tests">Run all tests in the current directory</string>
</resources>
\ No newline at end of file
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/FileFilter.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/FileFilter.java
index 4f2fc77..9427719 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/FileFilter.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/FileFilter.java
@@ -49,11 +49,11 @@
private static final String SSL_PATH = "ssl/";
private static final String TOKEN_SKIP = "SKIP";
- private static final String TOKEN_IGNORE_RESULT = "IGNORE_RESULT";
+ private static final String TOKEN_FAIL = "FAIL";
private static final String TOKEN_SLOW = "SLOW";
private final Set<String> mSkipList = new HashSet<String>();
- private final Set<String> mIgnoreResultList = new HashSet<String>();
+ private final Set<String> mFailList = new HashSet<String>();
private final Set<String> mSlowList = new HashSet<String>();
private final String mRootDirPath;
@@ -91,7 +91,6 @@
String[] parts;
String path;
Set<String> tokens;
- Boolean skipped;
while (true) {
line = bufferedReader.readLine();
if (line == null) {
@@ -122,21 +121,16 @@
tokens = new HashSet<String>(Arrays.asList(parts[1].split("\\s", 0)));
/** Chose the right collections to add to */
- skipped = false;
if (tokens.contains(TOKEN_SKIP)) {
mSkipList.add(path);
- skipped = true;
- }
- /** If test is on skip list we ignore any further options */
- if (skipped) {
+ /** If test is on skip list we ignore any further options */
continue;
}
- if (tokens.contains(TOKEN_IGNORE_RESULT)) {
- mIgnoreResultList.add(path);
+ if (tokens.contains(TOKEN_FAIL)) {
+ mFailList.add(path);
}
-
if (tokens.contains(TOKEN_SLOW)) {
mSlowList.add(path);
}
@@ -177,18 +171,18 @@
}
/**
- * Checks if test result is supposed to be ignored.
+ * Checks if test result is supposed to be "failed".
*
* <p>
* Path given should relative within LayoutTests folder, e.g. fast/dom/foo.html
*
* @param testPath
* - a relative path within LayoutTests folder
- * @return if the test result is supposed to be ignored
+ * @return if the test result is supposed to be "failed"
*/
- public boolean isIgnoreRes(String testPath) {
+ public boolean isFail(String testPath) {
for (String prefix : getPrefixes(testPath)) {
- if (mIgnoreResultList.contains(prefix)) {
+ if (mFailList.contains(prefix)) {
return true;
}
}
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java
index 7bbbc05..94ba35f 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java
@@ -183,9 +183,10 @@
private static final String TXT_SUMMARY_RELATIVE_PATH = "summary.txt";
private int mCrashedTestsCount = 0;
- private List<AbstractResult> mFailedNotIgnoredTests = new ArrayList<AbstractResult>();
- private List<AbstractResult> mIgnoredTests = new ArrayList<AbstractResult>();
- private List<String> mPassedNotIgnoredTests = new ArrayList<String>();
+ private List<AbstractResult> mUnexpectedFailures = new ArrayList<AbstractResult>();
+ private List<AbstractResult> mExpectedFailures = new ArrayList<AbstractResult>();
+ private List<String> mExpectedPasses = new ArrayList<String>();
+ private List<String> mUnexpectedPasses = new ArrayList<String>();
private FileFilter mFileFilter;
private String mResultsRootDirPath;
@@ -206,12 +207,18 @@
mCrashedTestsCount++;
}
- if (mFileFilter.isIgnoreRes(relativePath)) {
- mIgnoredTests.add(result);
- } else if (result.getResultCode() == AbstractResult.ResultCode.PASS) {
- mPassedNotIgnoredTests.add(relativePath);
+ if (result.getResultCode() == AbstractResult.ResultCode.PASS) {
+ if (mFileFilter.isFail(relativePath)) {
+ mUnexpectedPasses.add(relativePath);
+ } else {
+ mExpectedPasses.add(relativePath);
+ }
} else {
- mFailedNotIgnoredTests.add(result);
+ if (mFileFilter.isFail(relativePath)) {
+ mExpectedFailures.add(result);
+ } else {
+ mUnexpectedFailures.add(result);
+ }
}
}
@@ -226,9 +233,9 @@
public void reset() {
mCrashedTestsCount = 0;
- mFailedNotIgnoredTests.clear();
- mIgnoredTests.clear();
- mPassedNotIgnoredTests.clear();
+ mUnexpectedFailures.clear();
+ mExpectedFailures.clear();
+ mExpectedPasses.clear();
mDate = new Date();
}
@@ -246,9 +253,10 @@
txt.append("CRASHED (total among all tests): " + mCrashedTestsCount + "\n");
txt.append("-------------");
}
- txt.append("FAILED: " + mFailedNotIgnoredTests.size() + "\n");
- txt.append("IGNORED: " + mIgnoredTests.size() + "\n");
- txt.append("PASSED: " + mPassedNotIgnoredTests.size() + "\n");
+ txt.append("UNEXPECTED FAILURES: " + mUnexpectedFailures.size() + "\n");
+ txt.append("UNEXPECTED PASSES: " + mUnexpectedPasses.size() + "\n");
+ txt.append("EXPECTED FAILURES: " + mExpectedFailures.size() + "\n");
+ txt.append("EXPECTED PASSES: " + mExpectedPasses.size() + "\n");
FsUtils.writeDataToStorage(new File(mResultsRootDirPath, TXT_SUMMARY_RELATIVE_PATH),
txt.toString().getBytes(), false);
@@ -264,11 +272,13 @@
createTopSummaryTable(html);
- createResultsListWithDiff(html, "Failed", mFailedNotIgnoredTests);
+ createResultsListWithDiff(html, "Unexpected failures", mUnexpectedFailures);
- createResultsListWithDiff(html, "Ignored", mIgnoredTests);
+ createResultsListNoDiff(html, "Unexpected passes", mUnexpectedPasses);
- createResultsListNoDiff(html, "Passed", mPassedNotIgnoredTests);
+ createResultsListWithDiff(html, "Expected failures", mExpectedFailures);
+
+ createResultsListNoDiff(html, "Expected passes", mExpectedPasses);
html.append("</body></html>");
@@ -277,9 +287,10 @@
}
private int getTotalTestCount() {
- return mFailedNotIgnoredTests.size() +
- mPassedNotIgnoredTests.size() +
- mIgnoredTests.size();
+ return mUnexpectedFailures.size() +
+ mUnexpectedPasses.size() +
+ mExpectedPasses.size() +
+ mExpectedFailures.size();
}
private String getWebKitVersionFromUserAgentString() {
@@ -305,9 +316,10 @@
html.append("<table class=\"summary\">");
createSummaryTableRow(html, "TOTAL", getTotalTestCount());
createSummaryTableRow(html, "CRASHED", mCrashedTestsCount);
- createSummaryTableRow(html, "FAILED", mFailedNotIgnoredTests.size());
- createSummaryTableRow(html, "IGNORED", mIgnoredTests.size());
- createSummaryTableRow(html, "PASSED", mPassedNotIgnoredTests.size());
+ createSummaryTableRow(html, "UNEXPECTED FAILURES", mUnexpectedFailures.size());
+ createSummaryTableRow(html, "UNEXPECTED PASSES", mUnexpectedPasses.size());
+ createSummaryTableRow(html, "EXPECTED FAILURES", mExpectedFailures.size());
+ createSummaryTableRow(html, "EXPECTED PASSES", mExpectedPasses.size());
html.append("</table>");
}
@@ -329,25 +341,21 @@
for (AbstractResult result : resultsList) {
relativePath = result.getRelativePath();
resultCode = result.getResultCode();
+ assert resultCode != AbstractResult.ResultCode.PASS : "resultCode=" + resultCode;
html.append("<h3>");
- if (resultCode == AbstractResult.ResultCode.PASS) {
- html.append("<span class=\"sqr\">■ </span>");
- html.append("<span class=\"path\">" + relativePath + "</span>");
- } else {
- /**
- * Technically, two different paths could end up being the same, because
- * ':' is a valid character in a path. However, it is probably not going
- * to cause any problems in this case
- */
- id = relativePath.replace(File.separator, ":");
- html.append("<a href=\"#\" onClick=\"toggleDisplay('" + id + "');");
- html.append("return false;\">");
- html.append("<span class=\"tri\" id=\"tri." + id + "\">▶ </span>");
- html.append("<span class=\"path\">" + relativePath + "</span>");
- html.append("</a>");
- }
+ /**
+ * Technically, two different paths could end up being the same, because
+ * ':' is a valid character in a path. However, it is probably not going
+ * to cause any problems in this case
+ */
+ id = relativePath.replace(File.separator, ":");
+ html.append("<a href=\"#\" onClick=\"toggleDisplay('" + id + "');");
+ html.append("return false;\">");
+ html.append("<span class=\"tri\" id=\"tri." + id + "\">▶ </span>");
+ html.append("<span class=\"path\">" + relativePath + "</span>");
+ html.append("</a>");
html.append(" <span class=\"listItem " + resultCode.name() + "\">");
html.append(resultCode.toString());
@@ -369,16 +377,14 @@
html.append("</h3>");
- if (resultCode != AbstractResult.ResultCode.PASS) {
- html.append("<div class=\"diff\" style=\"display: none;\" id=\"" + id + "\">");
- html.append(result.getDiffAsHtml());
- html.append("<a href=\"#\" onClick=\"toggleDisplay('" + id + "');");
- html.append("return false;\">Hide</a>");
- html.append(" | ");
- html.append("<a href=\"" + getViewSourceUrl(relativePath).toString() + "\"");
- html.append(" target=\"_blank\">Show source</a>");
- html.append("</div>");
- }
+ html.append("<div class=\"diff\" style=\"display: none;\" id=\"" + id + "\">");
+ html.append(result.getDiffAsHtml());
+ html.append("<a href=\"#\" onClick=\"toggleDisplay('" + id + "');");
+ html.append("return false;\">Hide</a>");
+ html.append(" | ");
+ html.append("<a href=\"" + getViewSourceUrl(relativePath).toString() + "\"");
+ html.append(" target=\"_blank\">Show source</a>");
+ html.append("</div>");
html.append("<div class=\"space\"></div>");
}
@@ -387,7 +393,7 @@
private void createResultsListNoDiff(StringBuilder html, String title,
List<String> resultsList) {
Collections.sort(resultsList);
- html.append("<h2>Passed [" + resultsList.size() + "]</h2>");
+ html.append("<h2>" + title + "[" + resultsList.size() + "]</h2>");
for (String result : resultsList) {
html.append("<h3>");
html.append("<a href=\"" + getViewSourceUrl(result).toString() + "\"");
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/ConnectionHandler.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/ConnectionHandler.java
index 2ffb48f..c356a10 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/ConnectionHandler.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/ConnectionHandler.java
@@ -32,6 +32,10 @@
private static final String LOG_TAG = "ConnectionHandler";
+ public static interface OnFinishedCallback {
+ public void onFinished();
+ }
+
private class SocketPipeThread extends Thread {
private Socket mInSocket, mOutSocket;
@@ -69,6 +73,9 @@
break;
}
}
+
+ ConnectionHandler.this.stop();
+ mOnFinishedCallback.onFinished();
}
@Override
@@ -80,6 +87,8 @@
private Socket mFromSocket, mToSocket;
private SocketPipeThread mFromToPipe, mToFromPipe;
+ private OnFinishedCallback mOnFinishedCallback;
+
public ConnectionHandler(Socket fromSocket, Socket toSocket) {
mFromSocket = fromSocket;
mToSocket = toSocket;
@@ -87,6 +96,10 @@
mToFromPipe = new SocketPipeThread(mToSocket, mFromSocket);
}
+ public void registerOnConnectionHandlerFinishedCallback(OnFinishedCallback callback) {
+ mOnFinishedCallback = callback;
+ }
+
public void start() {
mFromToPipe.start();
mToFromPipe.start();
@@ -102,17 +115,23 @@
synchronized (mToFromPipe) {
/** This will stop the while loop in the run method */
try {
- socket.shutdownInput();
+ if (!socket.isInputShutdown()) {
+ socket.shutdownInput();
+ }
} catch (IOException e) {
Log.e(LOG_TAG, "mFromToPipe=" + mFromToPipe + " mToFromPipe=" + mToFromPipe, e);
}
try {
- socket.shutdownOutput();
+ if (!socket.isOutputShutdown()) {
+ socket.shutdownOutput();
+ }
} catch (IOException e) {
Log.e(LOG_TAG, "mFromToPipe=" + mFromToPipe + " mToFromPipe=" + mToFromPipe, e);
}
try {
- socket.close();
+ if (!socket.isClosed()) {
+ socket.close();
+ }
} catch (IOException e) {
Log.e(LOG_TAG, "mFromToPipe=" + mFromToPipe + " mToFromPipe=" + mToFromPipe, e);
}
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/Forwarder.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/Forwarder.java
index f948767..1b581fc 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/Forwarder.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/forwarder/Forwarder.java
@@ -92,14 +92,37 @@
continue;
}
- ConnectionHandler forwarder = new ConnectionHandler(localSocket, remoteSocket);
- mConnectionHandlers.add(forwarder);
- forwarder.start();
+ final ConnectionHandler connectionHandler =
+ new ConnectionHandler(localSocket, remoteSocket);
+ /**
+ * We have to close the sockets after the ConnectionHandler finishes, so we
+ * don't get "Too may open files" exception. We also remove the ConnectionHandler
+ * from the collection to avoid memory issues.
+ * */
+ ConnectionHandler.OnFinishedCallback callback =
+ new ConnectionHandler.OnFinishedCallback() {
+ @Override
+ public void onFinished() {
+ removeConncetionHandler(connectionHandler);
+ }
+ };
+ connectionHandler.registerOnConnectionHandlerFinishedCallback(callback);
+
+ mConnectionHandlers.add(connectionHandler);
+ connectionHandler.start();
}
}
}
+ private synchronized void removeConncetionHandler(ConnectionHandler connectionHandler) {
+ if (mConnectionHandlers.remove(connectionHandler)) {
+ Log.d(LOG_TAG, "removeConnectionHandler(): removed");
+ } else {
+ Log.d(LOG_TAG, "removeConnectionHandler(): not in the collection");
+ }
+ }
+
public void finish() {
try {
mServerSocket.close();
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java
index 2280c66..b1862ef 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java
@@ -35,6 +35,9 @@
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
@@ -205,11 +208,7 @@
showDir(item.getRelativePath());
} else {
/** Run the test */
- Intent intent = new Intent();
- intent.setClass(DirListActivity.this, TestsListActivity.class);
- intent.setAction(Intent.ACTION_RUN);
- intent.putExtra(TestsListActivity.EXTRA_TEST_PATH, item.getRelativePath());
- startActivity(intent);
+ runAllTestsUnder(item.getRelativePath());
}
}
});
@@ -236,6 +235,32 @@
showDir("");
}
+ private void runAllTestsUnder(String relativePath) {
+ Intent intent = new Intent();
+ intent.setClass(DirListActivity.this, TestsListActivity.class);
+ intent.setAction(Intent.ACTION_RUN);
+ intent.putExtra(TestsListActivity.EXTRA_TEST_PATH, relativePath);
+ startActivity(intent);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.gui_menu, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.run_all:
+ runAllTestsUnder(mCurrentDirPath);
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
@Override
/**
* Moves to the parent directory if one exists. Does not allow to move above
@@ -278,13 +303,7 @@
@Override
public void onClick(DialogInterface dialog, int which) {
removeDialog(DIALOG_RUN_ABORT_DIR);
- /** Run the tests */
- Intent intent = new Intent();
- intent.setClass(DirListActivity.this, TestsListActivity.class);
- intent.setAction(Intent.ACTION_RUN);
- intent.putExtra(TestsListActivity.EXTRA_TEST_PATH,
- args.getString("relativePath"));
- startActivity(intent);
+ runAllTestsUnder(args.getString("relativePath"));
}
});
diff --git a/voip/java/android/net/sip/SipManager.java b/voip/java/android/net/sip/SipManager.java
index 287a13a..40792b9 100644
--- a/voip/java/android/net/sip/SipManager.java
+++ b/voip/java/android/net/sip/SipManager.java
@@ -18,6 +18,7 @@
import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
@@ -69,22 +70,36 @@
private ISipService mSipService;
/**
- * Creates a manager instance and initializes the background SIP service.
- * Will be removed once the SIP service is integrated into framework.
+ * Gets a manager instance. Returns null if SIP API is not supported.
*
- * @param context context to start the SIP service
- * @return the manager instance
+ * @param context application context for checking if SIP API is supported
+ * @return the manager instance or null if SIP API is not supported
*/
- public static SipManager getInstance(final Context context) {
- final SipManager manager = new SipManager();
- manager.createSipService(context);
- return manager;
+ public static SipManager getInstance(Context context) {
+ return (isApiSupported(context) ? new SipManager() : null);
+ }
+
+ /**
+ * Returns true if the SIP API is supported by the system.
+ */
+ public static boolean isApiSupported(Context context) {
+ return context.getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_SIP);
+ }
+
+ /**
+ * Returns true if the system supports SIP-based VoIP.
+ */
+ public static boolean isVoipSupported(Context context) {
+ return context.getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_SIP_VOIP) && isApiSupported(context);
}
private SipManager() {
+ createSipService();
}
- private void createSipService(Context context) {
+ private void createSipService() {
if (mSipService != null) return;
IBinder b = ServiceManager.getService(Context.SIP_SERVICE);
mSipService = ISipService.Stub.asInterface(b);
diff --git a/voip/java/android/net/sip/SipProfile.java b/voip/java/android/net/sip/SipProfile.java
index 6c99141..aa2da75 100644
--- a/voip/java/android/net/sip/SipProfile.java
+++ b/voip/java/android/net/sip/SipProfile.java
@@ -46,8 +46,7 @@
private String mProfileName;
private boolean mSendKeepAlive = false;
private boolean mAutoRegistration = true;
- private boolean mAllowOutgoingCall = false;
- private int mCallingUid = -1;
+ private transient int mCallingUid = 0;
/** @hide */
public static final Parcelable.Creator<SipProfile> CREATOR =
@@ -245,18 +244,6 @@
}
/**
- * Sets the allow-outgoing-call flag.
- *
- * @param flag true if allowing to make outgoing call on the profile;
- * false otherwise
- * @return this builder object
- */
- public Builder setOutgoingCallAllowed(boolean flag) {
- mProfile.mAllowOutgoingCall = flag;
- return this;
- }
-
- /**
* Builds and returns the SIP profile object.
*
* @return the profile object created
@@ -293,7 +280,6 @@
mProfileName = in.readString();
mSendKeepAlive = (in.readInt() == 0) ? false : true;
mAutoRegistration = (in.readInt() == 0) ? false : true;
- mAllowOutgoingCall = (in.readInt() == 0) ? false : true;
mCallingUid = in.readInt();
}
@@ -307,7 +293,6 @@
out.writeString(mProfileName);
out.writeInt(mSendKeepAlive ? 1 : 0);
out.writeInt(mAutoRegistration ? 1 : 0);
- out.writeInt(mAllowOutgoingCall ? 1 : 0);
out.writeInt(mCallingUid);
}
@@ -435,13 +420,6 @@
}
/**
- * Returns true if allowing to make outgoing calls on this profile.
- */
- public boolean isOutgoingCallAllowed() {
- return mAllowOutgoingCall;
- }
-
- /**
* Sets the calling process's Uid in the sip service.
* @hide
*/
diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java
index 5a20736..9cc44b5 100644
--- a/wifi/java/android/net/wifi/WifiStateTracker.java
+++ b/wifi/java/android/net/wifi/WifiStateTracker.java
@@ -83,10 +83,8 @@
mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
IntentFilter filter = new IntentFilter();
- filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
filter.addAction(WifiManager.CONFIG_CHANGED_ACTION);
- filter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
mWifiStateReceiver = new WifiStateReceiver();
mContext.registerReceiver(mWifiStateReceiver, filter);