diff --git a/api/3.xml b/api/3.xml index 512fef8b184f8..c75281319230e 100644 --- a/api/3.xml +++ b/api/3.xml @@ -125608,7 +125608,7 @@ native="false" synchronized="false" static="false" - final="true" + final="false" deprecated="not deprecated" visibility="public" > @@ -125652,7 +125652,7 @@ native="false" synchronized="false" static="false" - final="true" + final="false" deprecated="not deprecated" visibility="public" > @@ -125665,7 +125665,7 @@ native="false" synchronized="false" static="false" - final="true" + final="false" deprecated="not deprecated" visibility="public" > diff --git a/api/current.xml b/api/current.xml index c9ed3c42ddebc..2260abb5abab1 100644 --- a/api/current.xml +++ b/api/current.xml @@ -12120,6 +12120,17 @@ visibility="public" > + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + @@ -146440,7 +146688,7 @@ native="false" synchronized="false" static="false" - final="true" + final="false" deprecated="not deprecated" visibility="public" > @@ -146453,7 +146701,7 @@ native="false" synchronized="false" static="false" - final="true" + final="false" deprecated="not deprecated" visibility="public" > @@ -157332,6 +157580,17 @@ visibility="public" > + + #include +#include +#include #include "CameraService.h" namespace android { @@ -151,6 +153,19 @@ void CameraService::removeClient(const sp& cameraClient) } } +static sp newMediaPlayer(const char *file) +{ + sp mp = new MediaPlayer(); + if (mp->setDataSource(file) == NO_ERROR) { + mp->setAudioStreamType(AudioSystem::ALARM); + mp->prepare(); + } else { + mp.clear(); + LOGE("Failed to load CameraService sounds."); + } + return mp; +} + CameraService::Client::Client(const sp& cameraService, const sp& cameraClient, pid_t clientPid) { @@ -161,6 +176,9 @@ CameraService::Client::Client(const sp& cameraService, mHardware = openCameraHardware(); mUseOverlay = mHardware->useOverlay(); + mMediaPlayerClick = newMediaPlayer("/system/media/audio/ui/camera_click.ogg"); + mMediaPlayerBeep = newMediaPlayer("/system/media/audio/ui/VideoRecord.ogg"); + // Callback is disabled by default mPreviewCallbackFlag = FRAME_CALLBACK_FLAG_NOOP; LOGD("Client X constructor"); @@ -265,6 +283,9 @@ CameraService::Client::~Client() #endif } + mMediaPlayerBeep.clear(); + mMediaPlayerClick.clear(); + // make sure we tear down the hardware mClientPid = IPCThreadState::self()->getCallingPid(); disconnect(); @@ -464,6 +485,9 @@ status_t CameraService::Client::startPreview() status_t CameraService::Client::startRecording() { + if (mMediaPlayerBeep.get() != NULL) { + mMediaPlayerBeep->start(); + } return startCameraMode(CAMERA_RECORDING_MODE); } @@ -502,6 +526,9 @@ void CameraService::Client::stopRecording() return; } + if (mMediaPlayerBeep.get() != NULL) { + mMediaPlayerBeep->start(); + } mHardware->stopRecording(); LOGV("stopRecording(), hardware stopped OK"); mPreviewBuffer.clear(); @@ -684,6 +711,9 @@ status_t CameraService::Client::takePicture() return INVALID_OPERATION; } + if (mMediaPlayerClick.get() != NULL) { + mMediaPlayerClick->start(); + } return mHardware->takePicture(shutterCallback, yuvPictureCallback, jpegPictureCallback, diff --git a/camera/libcameraservice/CameraService.h b/camera/libcameraservice/CameraService.h index d9b79276a72a8..6752f265dabbf 100644 --- a/camera/libcameraservice/CameraService.h +++ b/camera/libcameraservice/CameraService.h @@ -27,6 +27,8 @@ class android::MemoryHeapBase; namespace android { +class MediaPlayer; + // ---------------------------------------------------------------------------- #define LIKELY( exp ) (__builtin_expect( (exp) != 0, true )) @@ -178,6 +180,9 @@ private: sp mPreviewBuffer; int mPreviewCallbackFlag; + sp mMediaPlayerClick; + sp mMediaPlayerBeep; + // these are immutable once the object is created, // they don't need to be protected by a lock sp mCameraClient; diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index cb1e903d2bb3e..acf41eeb0f3be 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -114,6 +114,7 @@ public final class ActivityThread { private static final boolean DEBUG = false; private static final boolean localLOGV = DEBUG ? Config.LOGD : Config.LOGV; private static final boolean DEBUG_BROADCAST = false; + private static final boolean DEBUG_RESULTS = false; private static final long MIN_TIME_BETWEEN_GCS = 5*1000; private static final Pattern PATTERN_SEMICOLON = Pattern.compile(";"); private static final int SQLITE_MEM_RELEASED_EVENT_LOG_TAG = 75003; @@ -2118,6 +2119,8 @@ public final class ActivityThread { public final void sendActivityResult( IBinder token, String id, int requestCode, int resultCode, Intent data) { + if (DEBUG_RESULTS) Log.v(TAG, "sendActivityResult: id=" + id + + " req=" + requestCode + " res=" + resultCode + " data=" + data); ArrayList list = new ArrayList(); list.add(new ResultInfo(id, requestCode, resultCode, data)); mAppThread.scheduleSendResult(token, list); @@ -2993,6 +2996,8 @@ public final class ActivityThread { if (ri.mData != null) { ri.mData.setExtrasClassLoader(r.activity.getClassLoader()); } + if (DEBUG_RESULTS) Log.v(TAG, + "Delivering result to activity " + r + " : " + ri); r.activity.dispatchActivityResult(ri.mResultWho, ri.mRequestCode, ri.mResultCode, ri.mData); } catch (Exception e) { @@ -3008,7 +3013,7 @@ public final class ActivityThread { private final void handleSendResult(ResultData res) { ActivityRecord r = mActivities.get(res.token); - if (localLOGV) Log.v(TAG, "Handling send result to " + r); + if (DEBUG_RESULTS) Log.v(TAG, "Handling send result to " + r); if (r != null) { final boolean resumed = !r.paused; if (!r.activity.mFinished && r.activity.mDecor != null diff --git a/core/java/android/app/ApplicationContext.java b/core/java/android/app/ApplicationContext.java index ecef38f4378e4..55fce4932e6de 100644 --- a/core/java/android/app/ApplicationContext.java +++ b/core/java/android/app/ApplicationContext.java @@ -2723,10 +2723,8 @@ class ApplicationContext extends Context { mTimestamp = mFileStatus.mtime; } - // Writing was successful, delete the backup file - if (!mBackupFile.delete()) { - Log.e(TAG, "Couldn't delete new backup file " + mBackupFile); - } + // Writing was successful, delete the backup file if there is one. + mBackupFile.delete(); return true; } catch (XmlPullParserException e) { Log.w(TAG, "writeFileLocked: Got exception:", e); diff --git a/core/java/android/app/DatePickerDialog.java b/core/java/android/app/DatePickerDialog.java index ee5e0d5b577ca..863cbcc4d1130 100644 --- a/core/java/android/app/DatePickerDialog.java +++ b/core/java/android/app/DatePickerDialog.java @@ -47,6 +47,7 @@ public class DatePickerDialog extends AlertDialog implements OnClickListener, private final OnDateSetListener mCallBack; private final Calendar mCalendar; private final java.text.DateFormat mDateFormat; + private final java.text.DateFormat mTitleDateFormat; private final String[] mWeekDays; private int mInitialYear; @@ -108,6 +109,8 @@ public class DatePickerDialog extends AlertDialog implements OnClickListener, mWeekDays = symbols.getShortWeekdays(); mDateFormat = DateFormat.getMediumDateFormat(context); + mTitleDateFormat = java.text.DateFormat. + getDateInstance(java.text.DateFormat.FULL); mCalendar = Calendar.getInstance(); updateTitle(mInitialYear, mInitialMonth, mInitialDay); @@ -126,7 +129,7 @@ public class DatePickerDialog extends AlertDialog implements OnClickListener, @Override public void show() { super.show(); - + /* Sometimes the full month is displayed causing the title * to be very long, in those cases ensure it doesn't wrap to * 2 lines (as that looks jumpy) and ensure we ellipsize the end. @@ -160,8 +163,7 @@ public class DatePickerDialog extends AlertDialog implements OnClickListener, mCalendar.set(Calendar.YEAR, year); mCalendar.set(Calendar.MONTH, month); mCalendar.set(Calendar.DAY_OF_MONTH, day); - String weekday = mWeekDays[mCalendar.get(Calendar.DAY_OF_WEEK)]; - setTitle(weekday + ", " + mDateFormat.format(mCalendar.getTime())); + setTitle(mTitleDateFormat.format(mCalendar.getTime())); } @Override diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java index 25544deac10d1..5cc5730c098f3 100644 --- a/core/java/android/content/ContentProvider.java +++ b/core/java/android/content/ContentProvider.java @@ -172,7 +172,8 @@ public abstract class ContentProvider implements ComponentCallbacks { public ISyncAdapter getSyncAdapter() { checkWritePermission(null); - return ContentProvider.this.getSyncAdapter().getISyncAdapter(); + SyncAdapter sa = ContentProvider.this.getSyncAdapter(); + return sa != null ? sa.getISyncAdapter() : null; } private void checkReadPermission(Uri uri) { diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 306c02eca3d82..c514df754cef7 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -1125,7 +1125,8 @@ public class Intent implements Parcelable { public static final String ACTION_PACKAGE_INSTALL = "android.intent.action.PACKAGE_INSTALL"; /** * Broadcast Action: A new application package has been installed on the - * device. The data contains the name of the package. + * device. The data contains the name of the package. Note that the + * newly installed package does not receive this broadcast. *

My include the following extras: *

    *
  • {@link #EXTRA_UID} containing the integer uid assigned to the new package. @@ -1135,6 +1136,17 @@ public class Intent implements Parcelable { */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_PACKAGE_ADDED = "android.intent.action.PACKAGE_ADDED"; + /** + * Broadcast Action: A new version of an application package has been + * installed, replacing an existing version that was previously installed. + * The data contains the name of the package. + *

    My include the following extras: + *

      + *
    • {@link #EXTRA_UID} containing the integer uid assigned to the new package. + *
    + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED"; /** * Broadcast Action: An existing application package has been removed from * the device. The data contains the name of the package. The package @@ -1163,7 +1175,9 @@ public class Intent implements Parcelable { * Broadcast Action: The user has restarted a package, and all of its * processes have been killed. All runtime state * associated with it (processes, alarms, notifications, etc) should - * be removed. The data contains the name of the package. + * be removed. Note that the restarted package does not + * receive this broadcast. + * The data contains the name of the package. *
      *
    • {@link #EXTRA_UID} containing the integer uid assigned to the package. *
    @@ -1173,8 +1187,9 @@ public class Intent implements Parcelable { /** * Broadcast Action: The user has cleared the data of a package. This should * be preceded by {@link #ACTION_PACKAGE_RESTARTED}, after which all of - * its persistent data is erased and this broadcast sent. The data contains - * the name of the package. + * its persistent data is erased and this broadcast sent. + * Note that the cleared package does not + * receive this broadcast. The data contains the name of the package. *
      *
    • {@link #EXTRA_UID} containing the integer uid assigned to the package. *
    diff --git a/core/java/android/net/http/CertificateChainValidator.java b/core/java/android/net/http/CertificateChainValidator.java index 0edbe5b7e1a18..91fa900799231 100644 --- a/core/java/android/net/http/CertificateChainValidator.java +++ b/core/java/android/net/http/CertificateChainValidator.java @@ -43,7 +43,8 @@ class CertificateChainValidator { /** * The singleton instance of the certificate chain validator */ - private static CertificateChainValidator sInstance; + private static final CertificateChainValidator sInstance + = new CertificateChainValidator(); /** * Default trust manager (used to perform CA certificate validation) @@ -54,10 +55,6 @@ class CertificateChainValidator { * @return The singleton instance of the certificator chain validator */ public static CertificateChainValidator getInstance() { - if (sInstance == null) { - sInstance = new CertificateChainValidator(); - } - return sInstance; } @@ -159,13 +156,11 @@ class CertificateChainValidator { // report back to the user. // try { - synchronized (mDefaultTrustManager) { - mDefaultTrustManager.checkServerTrusted( - serverCertificates, "RSA"); + mDefaultTrustManager.checkServerTrusted( + serverCertificates, "RSA"); - // no errors!!! - return null; - } + // no errors!!! + return null; } catch (CertificateException e) { if (HttpLog.LOGV) { HttpLog.v( @@ -191,10 +186,8 @@ class CertificateChainValidator { // check if the last certificate in the chain (root) is trusted X509Certificate[] rootCertificateChain = { currCertificate }; try { - synchronized (mDefaultTrustManager) { - mDefaultTrustManager.checkServerTrusted( - rootCertificateChain, "RSA"); - } + mDefaultTrustManager.checkServerTrusted( + rootCertificateChain, "RSA"); } catch (CertificateExpiredException e) { String errorMessage = e.getMessage(); if (errorMessage == null) { diff --git a/core/java/android/net/http/HttpsConnection.java b/core/java/android/net/http/HttpsConnection.java index fe02d3ea64305..55b733f3ea6f0 100644 --- a/core/java/android/net/http/HttpsConnection.java +++ b/core/java/android/net/http/HttpsConnection.java @@ -17,61 +17,41 @@ package android.net.http; import android.content.Context; +import android.util.Log; +import org.apache.harmony.xnet.provider.jsse.FileClientSessionCache; +import org.apache.harmony.xnet.provider.jsse.SSLClientSessionCache; +import org.apache.harmony.xnet.provider.jsse.SSLContextImpl; +import org.apache.http.Header; +import org.apache.http.HttpException; +import org.apache.http.HttpHost; +import org.apache.http.HttpStatus; +import org.apache.http.ParseException; +import org.apache.http.ProtocolVersion; +import org.apache.http.StatusLine; +import org.apache.http.message.BasicHttpRequest; +import org.apache.http.params.BasicHttpParams; +import org.apache.http.params.HttpConnectionParams; +import org.apache.http.params.HttpParams; -import junit.framework.Assert; - -import java.io.IOException; - -import java.security.cert.X509Certificate; - -import java.net.Socket; -import java.net.InetSocketAddress; - -import javax.net.ssl.SSLContext; import javax.net.ssl.SSLException; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; - -import org.apache.http.Header; -import org.apache.http.HttpClientConnection; -import org.apache.http.HttpException; -import org.apache.http.HttpHost; -import org.apache.http.HttpRequest; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.ParseException; -import org.apache.http.ProtocolVersion; -import org.apache.http.StatusLine; -import org.apache.http.impl.DefaultHttpClientConnection; -import org.apache.http.message.BasicHttpRequest; -import org.apache.http.params.BasicHttpParams; -import org.apache.http.params.HttpParams; -import org.apache.http.params.HttpConnectionParams; - -/** - * Simple exception we throw if the SSL connection is closed by the user. - * - * {@hide} - */ -class SSLConnectionClosedByUserException extends SSLException { - - public SSLConnectionClosedByUserException(String reason) { - super(reason); - } -} +import java.io.File; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.security.KeyManagementException; +import java.security.cert.X509Certificate; /** * A Connection connecting to a secure http server or tunneling through * a http proxy server to a https server. + * + * @hide */ -class HttpsConnection extends Connection { - - /** - * SSL context - */ - private static SSLContext mSslContext = null; +public class HttpsConnection extends Connection { /** * SSL socket factory @@ -79,42 +59,59 @@ class HttpsConnection extends Connection { private static SSLSocketFactory mSslSocketFactory = null; static { - // initialize the socket factory - try { - mSslContext = SSLContext.getInstance("TLS"); - if (mSslContext != null) { - // here, trust managers is a single trust-all manager - TrustManager[] trustManagers = new TrustManager[] { - new X509TrustManager() { - public X509Certificate[] getAcceptedIssuers() { - return null; - } - - public void checkClientTrusted( - X509Certificate[] certs, String authType) { - } - - public void checkServerTrusted( - X509Certificate[] certs, String authType) { - } - } - }; - - mSslContext.init(null, trustManagers, null); - mSslSocketFactory = mSslContext.getSocketFactory(); - } - } catch (Exception t) { - if (HttpLog.LOGV) { - HttpLog.v("HttpsConnection: failed to initialize the socket factory"); - } - } + // This intiialization happens in the zygote. It triggers some + // lazy initialization that can will benefit later invocations of + // initializeEngine(). + initializeEngine(null); } /** - * @return The shared SSL context. + * @hide + * + * @param sessionDir directory to cache SSL sessions */ - /*package*/ static SSLContext getContext() { - return mSslContext; + public static void initializeEngine(File sessionDir) { + try { + SSLClientSessionCache cache = null; + if (sessionDir != null) { + Log.d("HttpsConnection", "Caching SSL sessions in " + + sessionDir + "."); + cache = FileClientSessionCache.usingDirectory(sessionDir); + } + + SSLContextImpl sslContext = new SSLContextImpl(); + + // here, trust managers is a single trust-all manager + TrustManager[] trustManagers = new TrustManager[] { + new X509TrustManager() { + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + public void checkClientTrusted( + X509Certificate[] certs, String authType) { + } + + public void checkServerTrusted( + X509Certificate[] certs, String authType) { + } + } + }; + + sslContext.engineInit(null, trustManagers, null, cache, null); + + synchronized (HttpsConnection.class) { + mSslSocketFactory = sslContext.engineGetSocketFactory(); + } + } catch (KeyManagementException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private synchronized static SSLSocketFactory getSocketFactory() { + return mSslSocketFactory; } /** @@ -252,10 +249,8 @@ class HttpsConnection extends Connection { if (statusCode == HttpStatus.SC_OK) { try { - synchronized (mSslSocketFactory) { - sslSock = (SSLSocket) mSslSocketFactory.createSocket( + sslSock = (SSLSocket) getSocketFactory().createSocket( proxySock, mHost.getHostName(), mHost.getPort(), true); - } } catch(IOException e) { if (sslSock != null) { sslSock.close(); @@ -288,14 +283,11 @@ class HttpsConnection extends Connection { } else { // if we do not have a proxy, we simply connect to the host try { - synchronized (mSslSocketFactory) { - sslSock = (SSLSocket) mSslSocketFactory.createSocket(); - - sslSock.setSoTimeout(SOCKET_TIMEOUT); - sslSock.connect(new InetSocketAddress(mHost.getHostName(), - mHost.getPort())); - - } + sslSock = (SSLSocket) getSocketFactory().createSocket(); + + sslSock.setSoTimeout(SOCKET_TIMEOUT); + sslSock.connect(new InetSocketAddress(mHost.getHostName(), + mHost.getPort())); } catch(IOException e) { if (sslSock != null) { sslSock.close(); @@ -371,6 +363,7 @@ class HttpsConnection extends Connection { BasicHttpParams params = new BasicHttpParams(); params.setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8192); conn.bind(sslSock, params); + return conn; } @@ -425,3 +418,15 @@ class HttpsConnection extends Connection { return "https"; } } + +/** + * Simple exception we throw if the SSL connection is closed by the user. + * + * {@hide} + */ +class SSLConnectionClosedByUserException extends SSLException { + + public SSLConnectionClosedByUserException(String reason) { + super(reason); + } +} diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java index 76c74df27838a..d492b6ae2c692 100644 --- a/core/java/android/os/BatteryStats.java +++ b/core/java/android/os/BatteryStats.java @@ -292,7 +292,7 @@ public abstract class BatteryStats implements Parcelable { * {@hide} */ public abstract long getPhoneOnTime(long batteryRealtime, int which); - + /** * Returns the time in milliseconds that wifi has been on while the device was * running on battery. @@ -300,7 +300,15 @@ public abstract class BatteryStats implements Parcelable { * {@hide} */ public abstract long getWifiOnTime(long batteryRealtime, int which); - + + /** + * Returns the time in milliseconds that wifi has been on and the driver has + * been in the running state while the device was running on battery. + * + * {@hide} + */ + public abstract long getWifiRunningTime(long batteryRealtime, int which); + /** * Returns the time in milliseconds that bluetooth has been on while the device was * running on battery. @@ -535,6 +543,7 @@ public abstract class BatteryStats implements Parcelable { final long screenOnTime = getScreenOnTime(batteryRealtime, which); final long phoneOnTime = getPhoneOnTime(batteryRealtime, which); final long wifiOnTime = getWifiOnTime(batteryRealtime, which); + final long wifiRunningTime = getWifiRunningTime(batteryRealtime, which); final long bluetoothOnTime = getBluetoothOnTime(batteryRealtime, which); StringBuilder sb = new StringBuilder(128); @@ -549,7 +558,8 @@ public abstract class BatteryStats implements Parcelable { // Dump misc stats dumpLine(pw, 0 /* uid */, category, MISC_DATA, - screenOnTime / 1000, phoneOnTime / 1000, wifiOnTime / 1000, bluetoothOnTime / 1000); + screenOnTime / 1000, phoneOnTime / 1000, wifiOnTime / 1000, + wifiRunningTime / 1000, bluetoothOnTime / 1000); if (which == STATS_UNPLUGGED) { dumpLine(pw, 0 /* uid */, category, BATTERY_DATA, getUnpluggedStartLevel(), @@ -667,7 +677,7 @@ public abstract class BatteryStats implements Parcelable { final long rawUptime = SystemClock.uptimeMillis() * 1000; final long rawRealtime = SystemClock.elapsedRealtime() * 1000; final long batteryUptime = getBatteryUptime(rawUptime); - final long batteryRealtime = getBatteryUptime(rawRealtime); + final long batteryRealtime = getBatteryRealtime(rawRealtime); final long whichBatteryUptime = computeBatteryUptime(rawUptime, which); final long whichBatteryRealtime = computeBatteryRealtime(rawRealtime, which); @@ -692,6 +702,7 @@ public abstract class BatteryStats implements Parcelable { final long screenOnTime = getScreenOnTime(batteryRealtime, which); final long phoneOnTime = getPhoneOnTime(batteryRealtime, which); + final long wifiRunningTime = getWifiRunningTime(batteryRealtime, which); final long wifiOnTime = getWifiOnTime(batteryRealtime, which); final long bluetoothOnTime = getBluetoothOnTime(batteryRealtime, which); pw.println(prefix @@ -701,6 +712,8 @@ public abstract class BatteryStats implements Parcelable { + "(" + formatRatioLocked(phoneOnTime, whichBatteryRealtime) + "), time with wifi on: " + formatTimeMs(wifiOnTime / 1000) + "(" + formatRatioLocked(wifiOnTime, whichBatteryRealtime) + + "), time with wifi running: " + formatTimeMs(wifiRunningTime / 1000) + + "(" + formatRatioLocked(wifiRunningTime, whichBatteryRealtime) + "), time with bluetooth on: " + formatTimeMs(bluetoothOnTime / 1000) + "(" + formatRatioLocked(bluetoothOnTime, whichBatteryRealtime)+ ")"); diff --git a/core/java/android/os/LocalPowerManager.java b/core/java/android/os/LocalPowerManager.java index 55d7972dd0078..9e88f5ae4ef08 100644 --- a/core/java/android/os/LocalPowerManager.java +++ b/core/java/android/os/LocalPowerManager.java @@ -20,12 +20,16 @@ package android.os; public interface LocalPowerManager { public static final int OTHER_EVENT = 0; public static final int CHEEK_EVENT = 1; - public static final int TOUCH_EVENT = 2; - public static final int BUTTON_EVENT = 3; // Button and trackball events. + public static final int TOUCH_EVENT = 2; // touch events are TOUCH for 300ms, and then either + // up events or LONG_TOUCH events. + public static final int LONG_TOUCH_EVENT = 3; + public static final int TOUCH_UP_EVENT = 4; + public static final int BUTTON_EVENT = 5; // Button and trackball events. public static final int POKE_LOCK_IGNORE_CHEEK_EVENTS = 0x1; public static final int POKE_LOCK_SHORT_TIMEOUT = 0x2; public static final int POKE_LOCK_MEDIUM_TIMEOUT = 0x4; + public static final int POKE_LOCK_IGNORE_TOUCH_AND_CHEEK_EVENTS = 0x8; public static final int POKE_LOCK_TIMEOUT_MASK = 0x6; diff --git a/core/java/android/provider/Checkin.java b/core/java/android/provider/Checkin.java index d11a9c52f86dd..a87f5fa23a61d 100644 --- a/core/java/android/provider/Checkin.java +++ b/core/java/android/provider/Checkin.java @@ -144,6 +144,43 @@ public final class Checkin { TEST, NETWORK_RX_MOBILE, NETWORK_TX_MOBILE, + MARKET_DOWNLOAD_REQUESTED, + MARKET_DOWNLOAD_SCHEDULED, + MARKET_DOWNLOAD_CANCELLED_PENDING, + MARKET_DOWNLOAD_CANCELLED, + MARKET_DOWNLOAD_OK, + MARKET_DOWNLOAD_FAILED, + MARKET_DOWNLOAD_DECLINED, + MARKET_INSTALL_SCHEDULED, + MARKET_INSTALL_FAILED, + MARKET_INSTALL_OK, + MARKET_REMOVE_SCHEDULED, + MARKET_REMOVE_MALICIOUS_SCHEDULED, + MARKET_REMOVE_ABORTED, + MARKET_REMOVE_FAILED, + MARKET_REMOVE_OK, + MARKET_UNINSTALL_SCHEDULED, + MARKET_REFUND_REQUESTED, + MARKET_REFUND_OK, + MARKET_REFUND_FAILED, + MARKET_REASON_ALREADY_EXISTS, + MARKET_REASON_INVALID_APK, + MARKET_REASON_INSUFFICIENT_STORAGE, + MARKET_REASON_DUPLICATE_PACKAGE, + MARKET_REASON_UPDATE_INCOMPATIBLE, + MARKET_REASON_MISSING_SHARED_LIBRARY, + MARKET_REASON_REPLACE_COULDNT_DELETE, + MARKET_REASON_PARSE_NOT_APK, + MARKET_REASON_PARSE_BAD_MANIFEST, + MARKET_REASON_PARSE_NO_CERTIFICATES, + MARKET_REASON_PARSE_INCONSISTENT_CERTIFICATES, + MARKET_REASON_PARSE_CERTIFICATE_ENCODING, + MARKET_REASON_PARSE_BAD_PACKAGE_NAME, + MARKET_REASON_PARSE_BAD_SHARED_USER_ID, + MARKET_REASON_PARSE_MANIFEST_MALFORMED, + MARKET_REASON_PARSE_MANIFEST_EMPTY, + MARKET_REASON_UNKNOWN, + MARKET_STALE_INSTALL_ATTEMPT, } } diff --git a/core/java/android/server/BluetoothDeviceService.java b/core/java/android/server/BluetoothDeviceService.java index b7e3846ab9eb2..a815e573ee78b 100644 --- a/core/java/android/server/BluetoothDeviceService.java +++ b/core/java/android/server/BluetoothDeviceService.java @@ -385,13 +385,14 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { // Parrot, Zhongshan General K-mate Electronics, Great Well // Electronics, Flaircomm Electronics, Jatty Electronics, Delphi, // Clarion, Novero, Denso (Lexus, Toyota), Johnson Controls (Acura), + // Continental Automotive, Harman/Becker private final ArrayList mAutoPairingBlacklisted = new ArrayList(Arrays.asList( "00:02:C7", "00:16:FE", "00:19:C1", "00:1B:FB", "00:1E:3D", "00:21:4F", "00:23:06", "00:24:33", "00:A0:79", "00:0E:6D", "00:13:E0", "00:21:E8", "00:60:57", "00:0E:9F", "00:12:1C", "00:18:91", "00:18:96", "00:13:04", "00:16:FD", "00:22:A0", "00:0B:4C", "00:60:6F", "00:23:3D", "00:C0:59", - "00:0A:30" + "00:0A:30", "00:1E:AE", "00:1C:D7" )); public synchronized void loadBondState() { diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java index 6be8eb96ba21d..6eabea461dec1 100644 --- a/core/java/android/server/BluetoothEventLoop.java +++ b/core/java/android/server/BluetoothEventLoop.java @@ -343,7 +343,7 @@ class BluetoothEventLoop { private void onPasskeyAgentCancel(String address) { address = address.toUpperCase(); - mPasskeyAgentRequestData.remove(address); + mBluetoothService.cancelPin(address); Intent intent = new Intent(BluetoothIntent.PAIRING_CANCEL_ACTION); intent.putExtra(BluetoothIntent.ADDRESS, address); mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); diff --git a/core/java/android/text/Html.java b/core/java/android/text/Html.java index 6f0be3a64f8df..200bbf4a15004 100644 --- a/core/java/android/text/Html.java +++ b/core/java/android/text/Html.java @@ -151,26 +151,22 @@ public class Html { for (int i = 0; i < text.length(); i = next) { next = text.nextSpanTransition(i, len, ParagraphStyle.class); ParagraphStyle[] style = text.getSpans(i, next, ParagraphStyle.class); - if (style.length > 0) { - out.append("
    0) { - out.append(">"); + out.append("
    "); } withinDiv(out, text, i, next); diff --git a/core/java/android/text/method/ArrowKeyMovementMethod.java b/core/java/android/text/method/ArrowKeyMovementMethod.java index 17c7a6cd8c880..92f628967d713 100644 --- a/core/java/android/text/method/ArrowKeyMovementMethod.java +++ b/core/java/android/text/method/ArrowKeyMovementMethod.java @@ -18,6 +18,7 @@ package android.text.method; import android.util.Log; import android.view.KeyEvent; +import android.graphics.Rect; import android.text.*; import android.widget.TextView; import android.view.View; @@ -202,23 +203,54 @@ implements MovementMethod public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) { + int initialScrollX = -1, initialScrollY = -1; + if (event.getAction() == MotionEvent.ACTION_UP) { + initialScrollX = Touch.getInitialScrollX(widget, buffer); + initialScrollY = Touch.getInitialScrollY(widget, buffer); + } + boolean handled = Touch.onTouchEvent(widget, buffer, event); if (widget.isFocused() && !widget.didTouchFocusSelect()) { if (event.getAction() == MotionEvent.ACTION_UP) { + // If we have scrolled, then the up shouldn't move the cursor, + // but we do need to make sure the cursor is still visible at + // the current scroll offset to avoid the scroll jumping later + // to show it. + if ((initialScrollY >= 0 && initialScrollY != widget.getScrollY()) || + (initialScrollX >= 0 && initialScrollX != widget.getScrollX())) { + widget.moveCursorToVisibleOffset(); + return true; + } + int x = (int) event.getX(); int y = (int) event.getY(); x -= widget.getTotalPaddingLeft(); y -= widget.getTotalPaddingTop(); + // Clamp the position to inside of the view. + if (x < 0) { + x = 0; + } else if (x >= (widget.getWidth()-widget.getTotalPaddingRight())) { + x = widget.getWidth()-widget.getTotalPaddingRight() - 1; + } + if (y < 0) { + y = 0; + } else if (y >= (widget.getHeight()-widget.getTotalPaddingBottom())) { + y = widget.getHeight()-widget.getTotalPaddingBottom() - 1; + } + x += widget.getScrollX(); y += widget.getScrollY(); Layout layout = widget.getLayout(); int line = layout.getLineForVertical(y); + int off = layout.getOffsetForHorizontal(line, x); + // XXX should do the same adjust for x as we do for the line. + boolean cap = (MetaKeyKeyListener.getMetaState(buffer, KeyEvent.META_SHIFT_ON) == 1) || (MetaKeyKeyListener.getMetaState(buffer, diff --git a/core/java/android/text/method/Touch.java b/core/java/android/text/method/Touch.java index 65036ad46d01d..f2fb9cb68d7fa 100644 --- a/core/java/android/text/method/Touch.java +++ b/core/java/android/text/method/Touch.java @@ -21,7 +21,6 @@ import android.text.NoCopySpan; import android.text.Layout.Alignment; import android.text.Spannable; import android.view.MotionEvent; -import android.view.View; import android.view.ViewConfiguration; import android.widget.TextView; @@ -82,8 +81,9 @@ public class Touch { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: - buffer.setSpan(new DragState(event.getX(), event.getY()), - 0, 0, Spannable.SPAN_MARK_MARK); + buffer.setSpan(new DragState(event.getX(), event.getY(), + widget.getScrollX(), widget.getScrollY()), + 0, 0, Spannable.SPAN_MARK_MARK); return true; case MotionEvent.ACTION_UP: @@ -142,15 +142,29 @@ public class Touch { return false; } + public static int getInitialScrollX(TextView widget, Spannable buffer) { + DragState[] ds = buffer.getSpans(0, buffer.length(), DragState.class); + return ds.length > 0 ? ds[0].mScrollX : -1; + } + + public static int getInitialScrollY(TextView widget, Spannable buffer) { + DragState[] ds = buffer.getSpans(0, buffer.length(), DragState.class); + return ds.length > 0 ? ds[0].mScrollY : -1; + } + private static class DragState implements NoCopySpan { public float mX; public float mY; + public int mScrollX; + public int mScrollY; public boolean mFarEnough; public boolean mUsed; - public DragState(float x, float y) { + public DragState(float x, float y, int scrollX, int scrollY) { mX = x; mY = y; + mScrollX = scrollX; + mScrollY = scrollY; } } } diff --git a/core/java/android/view/inputmethod/BaseInputConnection.java b/core/java/android/view/inputmethod/BaseInputConnection.java index deca910c6fbfb..11de3e2ed433d 100644 --- a/core/java/android/view/inputmethod/BaseInputConnection.java +++ b/core/java/android/view/inputmethod/BaseInputConnection.java @@ -51,7 +51,6 @@ public class BaseInputConnection implements InputConnection { static final Object COMPOSING = new ComposingText(); final InputMethodManager mIMM; - final Handler mH; final View mTargetView; final boolean mDummyMode; @@ -60,19 +59,17 @@ public class BaseInputConnection implements InputConnection { Editable mEditable; KeyCharacterMap mKeyCharacterMap; - BaseInputConnection(InputMethodManager mgr, boolean dummyMode) { + BaseInputConnection(InputMethodManager mgr, boolean fullEditor) { mIMM = mgr; mTargetView = null; - mH = null; - mDummyMode = dummyMode; + mDummyMode = !fullEditor; } - public BaseInputConnection(View targetView, boolean dummyMode) { + public BaseInputConnection(View targetView, boolean fullEditor) { mIMM = (InputMethodManager)targetView.getContext().getSystemService( Context.INPUT_METHOD_SERVICE); - mH = targetView.getHandler(); mTargetView = targetView; - mDummyMode = dummyMode; + mDummyMode = !fullEditor; } public static final void removeComposingSpans(Spannable text) { @@ -403,7 +400,7 @@ public class BaseInputConnection implements InputConnection { */ public boolean sendKeyEvent(KeyEvent event) { synchronized (mIMM.mH) { - Handler h = mH; + Handler h = mTargetView != null ? mTargetView.getHandler() : null; if (h == null) { if (mIMM.mServedView != null) { h = mIMM.mServedView.getHandler(); diff --git a/core/java/android/view/inputmethod/InputConnectionWrapper.java b/core/java/android/view/inputmethod/InputConnectionWrapper.java index e3d5e62151b10..210559aed9046 100644 --- a/core/java/android/view/inputmethod/InputConnectionWrapper.java +++ b/core/java/android/view/inputmethod/InputConnectionWrapper.java @@ -24,9 +24,21 @@ import android.view.KeyEvent; * and have fun! */ public class InputConnectionWrapper implements InputConnection { - private final InputConnection mTarget; + private InputConnection mTarget; + final boolean mMutable; - public InputConnectionWrapper(InputConnection target) { + public InputConnectionWrapper(InputConnection target, boolean mutable) { + mMutable = mutable; + mTarget = target; + } + + /** + * Change the target of the input connection. + */ + public void setTarget(InputConnection target) { + if (mTarget != null && !mMutable) { + throw new SecurityException("not mutable"); + } mTarget = target; } diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 4de9eef04d400..d79789059ca89 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -426,7 +426,7 @@ public final class InputMethodManager { } }; - final InputConnection mDummyInputConnection = new BaseInputConnection(this, true); + final InputConnection mDummyInputConnection = new BaseInputConnection(this, false); InputMethodManager(IInputMethodManager service, Looper looper) { mService = service; diff --git a/core/java/android/webkit/ContentLoader.java b/core/java/android/webkit/ContentLoader.java index fb01c8c6e85b1..f6d7f6990a45a 100644 --- a/core/java/android/webkit/ContentLoader.java +++ b/core/java/android/webkit/ContentLoader.java @@ -105,6 +105,9 @@ class ContentLoader extends StreamLoader { if (mContentType != null) { headers.setContentType("text/html"); } + // override the cache-control header set by StreamLoader as content can + // change, we don't want WebKit to cache it + headers.setCacheControl("no-store, no-cache"); } /** diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 965d900f32ac6..05636871064a2 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -41,8 +41,10 @@ import android.view.ViewConfiguration; import android.view.ViewDebug; import android.view.ViewGroup; import android.view.ViewTreeObserver; +import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; +import android.view.inputmethod.InputConnectionWrapper; import android.view.inputmethod.InputMethodManager; import android.view.ContextMenu.ContextMenuInfo; @@ -429,6 +431,9 @@ public abstract class AbsListView extends AdapterView implements Te private float mDensityScale; + private InputConnection mDefInputConnection; + private InputConnectionWrapper mPublicInputConnection; + /** * Interface definition for a callback to be invoked when the list or grid * has been scrolled. @@ -2932,7 +2937,46 @@ public abstract class AbsListView extends AdapterView implements Te // InputConnection to proxy to. Unfortunately this means we pretty // much need to make it as soon as a list view gets focus. createTextFilter(false); - return mTextFilter.onCreateInputConnection(outAttrs); + if (mPublicInputConnection == null) { + mDefInputConnection = new BaseInputConnection(this, false); + mPublicInputConnection = new InputConnectionWrapper( + mTextFilter.onCreateInputConnection(outAttrs), true) { + @Override + public boolean reportFullscreenMode(boolean enabled) { + // Use our own input connection, since it is + // the "real" one the IME is talking with. + return mDefInputConnection.reportFullscreenMode(enabled); + } + + @Override + public boolean performEditorAction(int editorAction) { + // The editor is off in its own window; we need to be + // the one that does this. + if (editorAction == EditorInfo.IME_ACTION_DONE) { + InputMethodManager imm = (InputMethodManager) + getContext().getSystemService( + Context.INPUT_METHOD_SERVICE); + if (imm != null) { + imm.hideSoftInputFromWindow(getWindowToken(), 0); + } + return true; + } + return false; + } + + @Override + public boolean sendKeyEvent(KeyEvent event) { + // Use our own input connection, since the filter + // text view may not be shown in a window so has + // no ViewRoot to dispatch events with. + return mDefInputConnection.sendKeyEvent(event); + } + }; + } + outAttrs.inputType = EditorInfo.TYPE_CLASS_TEXT + | EditorInfo.TYPE_TEXT_VARIATION_FILTER; + outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE; + return mPublicInputConnection; } return null; } @@ -3019,14 +3063,16 @@ public abstract class AbsListView extends AdapterView implements Te } /** - * For our text watcher that associated with the text filter + * For our text watcher that is associated with the text filter. Does + * nothing. */ public void beforeTextChanged(CharSequence s, int start, int count, int after) { } /** - * For our text watcher that associated with the text filter. Performs the actual - * filtering as the text changes. + * For our text watcher that is associated with the text filter. Performs + * the actual filtering as the text changes, and takes care of hiding and + * showing the popup displaying the currently entered filter text. */ public void onTextChanged(CharSequence s, int start, int before, int count) { if (mPopup != null && isTextFilterEnabled()) { @@ -3038,7 +3084,7 @@ public abstract class AbsListView extends AdapterView implements Te mFiltered = true; } else if (showing && length == 0) { // Remove the filter popup if the user has cleared all text - mPopup.dismiss(); + dismissPopup(); mFiltered = false; } if (mAdapter instanceof Filterable) { @@ -3055,7 +3101,8 @@ public abstract class AbsListView extends AdapterView implements Te } /** - * For our text watcher that associated with the text filter + * For our text watcher that is associated with the text filter. Does + * nothing. */ public void afterTextChanged(Editable s) { } diff --git a/core/java/android/widget/CursorAdapter.java b/core/java/android/widget/CursorAdapter.java index 898e501a183f2..da90a9f402944 100644 --- a/core/java/android/widget/CursorAdapter.java +++ b/core/java/android/widget/CursorAdapter.java @@ -127,7 +127,7 @@ public abstract class CursorAdapter extends BaseAdapter implements Filterable, /** * @see android.widget.ListAdapter#getCount() */ - public final int getCount() { + public int getCount() { if (mDataValid && mCursor != null) { return mCursor.getCount(); } else { @@ -138,7 +138,7 @@ public abstract class CursorAdapter extends BaseAdapter implements Filterable, /** * @see android.widget.ListAdapter#getItem(int) */ - public final Object getItem(int position) { + public Object getItem(int position) { if (mDataValid && mCursor != null) { mCursor.moveToPosition(position); return mCursor; @@ -150,7 +150,7 @@ public abstract class CursorAdapter extends BaseAdapter implements Filterable, /** * @see android.widget.ListAdapter#getItemId(int) */ - public final long getItemId(int position) { + public long getItemId(int position) { if (mDataValid && mCursor != null) { if (mCursor.moveToPosition(position)) { return mCursor.getLong(mRowIDColumn); diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java index 2bb716cbf1510..47db6f2745382 100644 --- a/core/java/android/widget/FrameLayout.java +++ b/core/java/android/widget/FrameLayout.java @@ -56,7 +56,9 @@ public class FrameLayout extends ViewGroup { private final Rect mSelfBounds = new Rect(); private final Rect mOverlayBounds = new Rect(); private int mForegroundGravity = Gravity.FILL; - private boolean mForegroundInPadding = true; + + /** {@hide} */ + protected boolean mForegroundInPadding = true; public FrameLayout(Context context) { super(context); diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java index aced533192a3c..4d5032ea3129f 100644 --- a/core/java/android/widget/ListView.java +++ b/core/java/android/widget/ListView.java @@ -2054,18 +2054,19 @@ public class ListView extends AbsListView { */ private boolean handleHorizontalFocusWithinListItem(int direction) { if (direction != View.FOCUS_LEFT && direction != View.FOCUS_RIGHT) { - throw new IllegalArgumentException("direction must be one of {View.FOCUS_LEFT, View.FOCUS_RIGHT}"); + throw new IllegalArgumentException("direction must be one of" + + " {View.FOCUS_LEFT, View.FOCUS_RIGHT}"); } final int numChildren = getChildCount(); if (mItemsCanFocus && numChildren > 0 && mSelectedPosition != INVALID_POSITION) { final View selectedView = getSelectedView(); - if (selectedView.hasFocus() && selectedView instanceof ViewGroup) { + if (selectedView != null && selectedView.hasFocus() && + selectedView instanceof ViewGroup) { + final View currentFocus = selectedView.findFocus(); final View nextFocus = FocusFinder.getInstance().findNextFocus( - (ViewGroup) selectedView, - currentFocus, - direction); + (ViewGroup) selectedView, currentFocus, direction); if (nextFocus != null) { // do the math to get interesting rect in next focus' coordinates currentFocus.getFocusedRect(mTempRect); @@ -2079,11 +2080,8 @@ public class ListView extends AbsListView { // if the global result is going to be some other view within this // list. this is to acheive the overall goal of having // horizontal d-pad navigation remain in the current item. - final View globalNextFocus = FocusFinder.getInstance() - .findNextFocus( - (ViewGroup) getRootView(), - currentFocus, - direction); + final View globalNextFocus = FocusFinder.getInstance().findNextFocus( + (ViewGroup) getRootView(), currentFocus, direction); if (globalNextFocus != null) { return isViewAncestorOf(globalNextFocus, this); } @@ -2769,6 +2767,8 @@ public class ListView extends AbsListView { final boolean headerDividers = mHeaderDividersEnabled; final boolean footerDividers = mFooterDividersEnabled; final int first = mFirstPosition; + final boolean areAllItemsSelectable = mAreAllItemsSelectable; + final ListAdapter adapter = mAdapter; if (!mStackFromBottom) { int bottom; @@ -2779,7 +2779,10 @@ public class ListView extends AbsListView { (footerDividers || first + i < footerLimit)) { View child = getChildAt(i); bottom = child.getBottom(); - if (bottom < listBottom) { + // Don't draw dividers next to items that are not enabled + if (bottom < listBottom && (areAllItemsSelectable || + (adapter.isEnabled(first + i) && (i == count - 1 || + adapter.isEnabled(first + i + 1))))) { bounds.top = bottom; bounds.bottom = bottom + dividerHeight; drawDivider(canvas, bounds, i); @@ -2795,7 +2798,10 @@ public class ListView extends AbsListView { (footerDividers || first + i < footerLimit)) { View child = getChildAt(i); top = child.getTop(); - if (top > listTop) { + // Don't draw dividers next to items that are not enabled + if (top > listTop && (areAllItemsSelectable || + (adapter.isEnabled(first + i) && (i == count - 1 || + adapter.isEnabled(first + i + 1))))) { bounds.top = top - dividerHeight; bounds.bottom = top; // Give the method the child ABOVE the divider, so we diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 136752b9f3a2f..81516b9158dce 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -727,7 +727,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE); } else if (phone) { mInput = DialerKeyListener.getInstance(); - inputType = EditorInfo.TYPE_CLASS_PHONE; + mInputType = inputType = EditorInfo.TYPE_CLASS_PHONE; } else if (numeric != 0) { mInput = DigitsKeyListener.getInstance((numeric & SIGNED) != 0, (numeric & DECIMAL) != 0); @@ -5421,6 +5421,62 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return changed; } + /** + * Move the cursor, if needed, so that it is at an offset that is visible + * to the user. This will not move the cursor if it represents more than + * one character (a selection range). This will only work if the + * TextView contains spannable text; otherwise it will do nothing. + */ + public boolean moveCursorToVisibleOffset() { + if (!(mText instanceof Spannable)) { + return false; + } + int start = Selection.getSelectionStart(mText); + int end = Selection.getSelectionEnd(mText); + if (start != end) { + return false; + } + + // First: make sure the line is visible on screen: + + int line = mLayout.getLineForOffset(start); + + final int top = mLayout.getLineTop(line); + final int bottom = mLayout.getLineTop(line+1); + final int vspace = mBottom - mTop - getExtendedPaddingTop() - getExtendedPaddingBottom(); + int vslack = (bottom - top) / 2; + if (vslack > vspace / 4) + vslack = vspace / 4; + final int vs = mScrollY; + + if (top < (vs+vslack)) { + line = mLayout.getLineForVertical(vs+vslack+(bottom-top)); + } else if (bottom > (vspace+vs-vslack)) { + line = mLayout.getLineForVertical(vspace+vs-vslack-(bottom-top)); + } + + // Next: make sure the character is visible on screen: + + final int hspace = mRight - mLeft - getCompoundPaddingLeft() - getCompoundPaddingRight(); + final int hs = mScrollX; + final int leftChar = mLayout.getOffsetForHorizontal(line, hs); + final int rightChar = mLayout.getOffsetForHorizontal(line, hspace+hs); + + int newStart = start; + if (newStart < leftChar) { + newStart = leftChar; + } else if (newStart > rightChar) { + newStart = rightChar; + } + + if (newStart != start) { + Selection.setSelection((Spannable)mText, newStart); + return true; + } + + return false; + } + @Override public void computeScroll() { if (mScroller != null) { diff --git a/core/java/com/android/internal/app/IBatteryStats.aidl b/core/java/com/android/internal/app/IBatteryStats.aidl index d259756530654..e0de421450858 100644 --- a/core/java/com/android/internal/app/IBatteryStats.aidl +++ b/core/java/com/android/internal/app/IBatteryStats.aidl @@ -32,6 +32,8 @@ interface IBatteryStats { void notePhoneOff(); void noteWifiOn(); void noteWifiOff(); + void noteWifiRunning(); + void noteWifiStopped(); void noteBluetoothOn(); void noteBluetoothOff(); void noteFullWifiLockAcquired(int uid); diff --git a/core/java/com/android/internal/database/SortCursor.java b/core/java/com/android/internal/database/SortCursor.java index af0efc9195cf0..99410bcaa478a 100644 --- a/core/java/com/android/internal/database/SortCursor.java +++ b/core/java/com/android/internal/database/SortCursor.java @@ -253,7 +253,15 @@ public class SortCursor extends AbstractCursor if (mCursor != null) { return mCursor.getColumnNames(); } else { - return new String[0]; + // All of the cursors may be empty, but they can still return + // this information. + int length = mCursors.length; + for (int i = 0 ; i < length ; i++) { + if (mCursors[i] != null) { + return mCursors[i].getColumnNames(); + } + } + throw new IllegalStateException("No cursor that can return names"); } } diff --git a/core/java/com/android/internal/logging/AndroidHandler.java b/core/java/com/android/internal/logging/AndroidHandler.java index d9fcf60756eac..c4a147959a9b6 100644 --- a/core/java/com/android/internal/logging/AndroidHandler.java +++ b/core/java/com/android/internal/logging/AndroidHandler.java @@ -151,7 +151,7 @@ public class AndroidHandler extends Handler { Log.e("AndroidHandler", "Error logging message.", e); } } - + /** * Converts a {@link java.util.logging.Logger} logging level into an Android one. * @@ -159,20 +159,16 @@ public class AndroidHandler extends Handler { * * @return The resulting Android logging level. */ - static int getAndroidLevel(Level level) - { + static int getAndroidLevel(Level level) { int value = level.intValue(); - - if (value >= Level.SEVERE.intValue()) { + if (value >= 1000) { // SEVERE return Log.ERROR; - } else if (value >= Level.WARNING.intValue()) { + } else if (value >= 900) { // WARNING return Log.WARN; - } else if (value >= Level.INFO.intValue()) { + } else if (value >= 800) { // INFO return Log.INFO; - } else if (value >= Level.CONFIG.intValue()) { + } else { return Log.DEBUG; - } else { - return Log.VERBOSE; } } diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index b3ae0d6adaa75..38335b55fbe7a 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -47,7 +47,7 @@ public final class BatteryStatsImpl extends BatteryStats { private static final int MAGIC = 0xBA757475; // 'BATSTATS' // Current on-disk Parcel version - private static final int VERSION = 27; + private static final int VERSION = 28; private final File mFile; private final File mBackupFile; @@ -94,6 +94,9 @@ public final class BatteryStatsImpl extends BatteryStats { boolean mWifiOn; Timer mWifiOnTimer; + + boolean mWifiRunning; + Timer mWifiRunningTimer; boolean mBluetoothOn; Timer mBluetoothOnTimer; @@ -497,6 +500,20 @@ public final class BatteryStatsImpl extends BatteryStats { } } + public void noteWifiRunningLocked() { + if (!mWifiRunning) { + mWifiRunning = true; + mWifiRunningTimer.startRunningLocked(this); + } + } + + public void noteWifiStoppedLocked() { + if (mWifiRunning) { + mWifiRunning = false; + mWifiRunningTimer.stopRunningLocked(this); + } + } + public void noteBluetoothOnLocked() { if (!mBluetoothOn) { mBluetoothOn = true; @@ -551,6 +568,10 @@ public final class BatteryStatsImpl extends BatteryStats { return mWifiOnTimer.getTotalTime(batteryRealtime, which); } + @Override public long getWifiRunningTime(long batteryRealtime, int which) { + return mWifiRunningTimer.getTotalTime(batteryRealtime, which); + } + @Override public long getBluetoothOnTime(long batteryRealtime, int which) { return mBluetoothOnTimer.getTotalTime(batteryRealtime, which); } @@ -1597,7 +1618,8 @@ public final class BatteryStatsImpl extends BatteryStats { mScreenOnTimer = new Timer(-1, null, mUnpluggables); mPhoneOnTimer = new Timer(-2, null, mUnpluggables); mWifiOnTimer = new Timer(-3, null, mUnpluggables); - mBluetoothOnTimer = new Timer(-4, null, mUnpluggables); + mWifiRunningTimer = new Timer(-4, null, mUnpluggables); + mBluetoothOnTimer = new Timer(-5, null, mUnpluggables); mOnBattery = mOnBatteryInternal = false; mTrackBatteryPastUptime = 0; mTrackBatteryPastRealtime = 0; @@ -1935,6 +1957,8 @@ public final class BatteryStatsImpl extends BatteryStats { mPhoneOnTimer.readSummaryFromParcelLocked(in); mWifiOn = false; mWifiOnTimer.readSummaryFromParcelLocked(in); + mWifiRunning = false; + mWifiRunningTimer.readSummaryFromParcelLocked(in); mBluetoothOn = false; mBluetoothOnTimer.readSummaryFromParcelLocked(in); @@ -2038,6 +2062,7 @@ public final class BatteryStatsImpl extends BatteryStats { mScreenOnTimer.writeSummaryFromParcelLocked(out, NOWREAL); mPhoneOnTimer.writeSummaryFromParcelLocked(out, NOWREAL); mWifiOnTimer.writeSummaryFromParcelLocked(out, NOWREAL); + mWifiRunningTimer.writeSummaryFromParcelLocked(out, NOWREAL); mBluetoothOnTimer.writeSummaryFromParcelLocked(out, NOWREAL); final int NU = mUidStats.size(); @@ -2163,6 +2188,8 @@ public final class BatteryStatsImpl extends BatteryStats { mPhoneOnTimer = new Timer(-2, null, mUnpluggables, in); mWifiOn = false; mWifiOnTimer = new Timer(-2, null, mUnpluggables, in); + mWifiRunning = false; + mWifiRunningTimer = new Timer(-2, null, mUnpluggables, in); mBluetoothOn = false; mBluetoothOnTimer = new Timer(-2, null, mUnpluggables, in); mUptime = in.readLong(); @@ -2217,6 +2244,7 @@ public final class BatteryStatsImpl extends BatteryStats { mScreenOnTimer.writeToParcel(out, batteryRealtime); mPhoneOnTimer.writeToParcel(out, batteryRealtime); mWifiOnTimer.writeToParcel(out, batteryRealtime); + mWifiRunningTimer.writeToParcel(out, batteryRealtime); mBluetoothOnTimer.writeToParcel(out, batteryRealtime); out.writeLong(mUptime); out.writeLong(mUptimeStart); @@ -2264,6 +2292,8 @@ public final class BatteryStatsImpl extends BatteryStats { mPhoneOnTimer.logState(); Log.i(TAG, "*** Wifi timer:"); mWifiOnTimer.logState(); + Log.i(TAG, "*** WifiRunning timer:"); + mWifiRunningTimer.logState(); Log.i(TAG, "*** Bluetooth timer:"); mBluetoothOnTimer.logState(); } diff --git a/core/java/com/android/internal/widget/EditStyledText.java b/core/java/com/android/internal/widget/EditStyledText.java index 8a4675a4c82fa..b36707e17da09 100644 --- a/core/java/com/android/internal/widget/EditStyledText.java +++ b/core/java/com/android/internal/widget/EditStyledText.java @@ -16,6 +16,8 @@ package com.android.internal.widget; +import java.util.ArrayList; + import android.app.AlertDialog.Builder; import android.content.Context; import android.content.DialogInterface; @@ -23,14 +25,21 @@ import android.net.Uri; import android.os.Bundle; import android.text.Editable; import android.text.Html; +import android.text.Layout; import android.text.Spannable; +import android.text.method.ArrowKeyMovementMethod; import android.text.style.AbsoluteSizeSpan; +import android.text.style.AlignmentSpan; import android.text.style.ForegroundColorSpan; import android.text.style.ImageSpan; import android.util.AttributeSet; import android.util.Log; +import android.view.KeyEvent; import android.view.MotionEvent; +import android.view.View; +import android.view.inputmethod.InputMethodManager; import android.widget.EditText; +import android.widget.TextView; /** * EditStyledText extends EditText for managing the flow and status to edit @@ -57,6 +66,10 @@ public class EditStyledText extends EditText { public static final int MODE_COLOR = 4; /** The mode of selection. */ public static final int MODE_SELECT = 5; + /** The mode of changing alignment. */ + public static final int MODE_ALIGN = 6; + /** The mode of changing cut. */ + public static final int MODE_CUT = 7; /** * The state of selection. @@ -85,6 +98,7 @@ public class EditStyledText extends EditText { */ public interface EditStyledTextNotifier { public void notifyHintMsg(int msgId); + public void notifyStateChanged(int mode, int state); } private EditStyledTextNotifier mESTInterface; @@ -167,14 +181,23 @@ public class EditStyledText extends EditText { sizesendints); } + public void setAlignAlertParams(CharSequence aligntitle, + CharSequence[] alignnames) { + mToast.setAlignAlertParams(aligntitle, alignnames); + } + @Override public boolean onTouchEvent(MotionEvent event) { + if (mManager.isSoftKeyBlocked() && + event.getAction() == MotionEvent.ACTION_UP) { + cancelLongPress(); + } final boolean superResult = super.onTouchEvent(event); if (event.getAction() == MotionEvent.ACTION_UP) { if (DBG) { Log.d(LOG_TAG, "--- onTouchEvent"); } - mManager.onTouchScreen(); + mManager.onCursorMoved(); } return superResult; } @@ -201,6 +224,13 @@ public class EditStyledText extends EditText { mManager.onStartCopy(); } + /** + * Start "Cut" action. + */ + public void onStartCut() { + mManager.onStartCut(); + } + /** * Start "Paste" action. */ @@ -222,6 +252,13 @@ public class EditStyledText extends EditText { mManager.onStartColor(); } + /** + * Start changing "Alignment" action. + */ + public void onStartAlign() { + mManager.onStartAlign(); + } + /** * Start "Select" action. */ @@ -236,6 +273,13 @@ public class EditStyledText extends EditText { mManager.onStartSelectAll(); } + /** + * Fix Selected Item. + */ + public void onFixSelectedItem() { + mManager.onFixSelectedItem(); + } + /** * InsertImage to TextView by using URI * @@ -256,13 +300,6 @@ public class EditStyledText extends EditText { mManager.onInsertImage(resId); } - /** - * Fix Selected Item. - */ - public void fixSelectedItem() { - mManager.onFixSelectItem(); - } - /** * Set Size of the Item. * @@ -283,16 +320,12 @@ public class EditStyledText extends EditText { mManager.setItemColor(color); } - public void onShowColorAlert() { - mToast.onShowColorAlertDialog(); - } - - public void onShowSizeAlert() { - mToast.onShowSizeAlertDialog(); + public void setAlignment(Layout.Alignment align) { + mManager.setAlignment(align); } /** - * Check editing is started. + * Check whether editing is started or not. * * @return Whether editing is started or not. */ @@ -300,6 +333,15 @@ public class EditStyledText extends EditText { return mManager.isEditting(); } + /** + * Check whether SoftKey is Blocked or not. + * + * @return whether SoftKey is Blocked or not. + */ + public boolean isSoftKeyBlocked() { + return mManager.isSoftKeyBlocked(); + } + /** * Get the mode of the action. * @@ -318,7 +360,33 @@ public class EditStyledText extends EditText { return mManager.getSelectState(); } - public String getBody() { + @Override + public Bundle getInputExtras(boolean create) { + Bundle bundle = super.getInputExtras(create); + if (bundle != null) { + bundle.putBoolean("allowEmoji", true); + } + return bundle; + } + + /** + * Get the state of the selection. + * + * @return The state of the selection. + */ + public String getHtml() { + return mConverter.getConvertedBody(); + } + + /** + * Get the state of the selection. + * + * @param uris + * The array of used uris. + * @return The state of the selection. + */ + public String getHtml(ArrayList uris) { + mConverter.getUriArray(uris, this.getText()); return mConverter.getConvertedBody(); } @@ -333,6 +401,28 @@ public class EditStyledText extends EditText { mManager = new EditorManager(this); mConverter = new StyledTextConverter(this); mToast = new StyledTextToast(this); + setMovementMethod(new StyledTextArrowKeyMethod(mManager)); + } + + /** + * Show Color Selecting Dialog. + */ + private void onShowColorAlert() { + mToast.onShowColorAlertDialog(); + } + + /** + * Show Size Selecting Dialog. + */ + private void onShowSizeAlert() { + mToast.onShowSizeAlertDialog(); + } + + /** + * Show Alignment Selecting Dialog. + */ + private void onShowAlignAlert() { + mToast.onShowAlignAlertDialog(); } /** @@ -347,27 +437,31 @@ public class EditStyledText extends EditText { } } - @Override - public Bundle getInputExtras(boolean create) { - Bundle bundle = super.getInputExtras(create); - if (bundle != null) { - bundle.putBoolean("allowEmoji", true); + /** + * Notify the event that the mode and state are changed. + * + * @param mode + * Mode of the editing action. + * @param state + * Mode of the selection state. + */ + private void notifyStateChanged(int mode, int state) { + if (mESTInterface != null) { + mESTInterface.notifyStateChanged(mode, state); } - return bundle; } /** - * Object which manages the flow and status of editing actions. + * EditorManager manages the flow and status of editing actions. */ private class EditorManager { private boolean mEditFlag = false; + private boolean mSoftKeyBlockFlag = false; private int mMode = 0; private int mState = 0; private int mCurStart = 0; private int mCurEnd = 0; private EditStyledText mEST; - private Editable mTextSelectBuffer; - private CharSequence mTextCopyBufer; EditorManager(EditStyledText est) { mEST = est; @@ -375,37 +469,133 @@ public class EditStyledText extends EditText { public void onStartEdit() { if (DBG) { - Log.d(LOG_TAG, "--- onEdit"); + Log.d(LOG_TAG, "--- onStartEdit"); } + Log.d(LOG_TAG, "--- onstartedit:" + this.getSelectionStart() + this.getSelectionEnd()); handleResetEdit(); + mEST.notifyStateChanged(mMode, mState); } public void onEndEdit() { if (DBG) { - Log.d(LOG_TAG, "--- onClickCancel"); + Log.d(LOG_TAG, "--- onEndEdit"); } handleCancel(); + mEST.notifyStateChanged(mMode, mState); } public void onStartCopy() { if (DBG) { - Log.d(LOG_TAG, "--- onClickCopy"); + Log.d(LOG_TAG, "--- onStartCopy"); } handleCopy(); + mEST.notifyStateChanged(mMode, mState); + } + + public void onStartCut() { + if (DBG) { + Log.d(LOG_TAG, "--- onStartCut"); + } + handleCut(); + mEST.notifyStateChanged(mMode, mState); } public void onStartPaste() { if (DBG) { - Log.d(LOG_TAG, "--- onClickPaste"); + Log.d(LOG_TAG, "--- onStartPaste"); } handlePaste(); + mEST.notifyStateChanged(mMode, mState); } public void onStartSize() { if (DBG) { - Log.d(LOG_TAG, "--- onClickSize"); + Log.d(LOG_TAG, "--- onStartSize"); } handleSize(); + mEST.notifyStateChanged(mMode, mState); + } + + public void onStartAlign() { + if (DBG) { + Log.d(LOG_TAG, "--- onStartAlignRight"); + } + handleAlign(); + mEST.notifyStateChanged(mMode, mState); + } + + public void onStartColor() { + if (DBG) { + Log.d(LOG_TAG, "--- onClickColor"); + } + handleColor(); + mEST.notifyStateChanged(mMode, mState); + } + + public void onStartSelect() { + if (DBG) { + Log.d(LOG_TAG, "--- onClickSelect"); + } + mMode = MODE_SELECT; + if (mState == STATE_SELECT_OFF) { + handleSelect(); + } else { + unsetSelect(); + handleSelect(); + } + mEST.notifyStateChanged(mMode, mState); + } + + public void onCursorMoved() { + if (DBG) { + Log.d(LOG_TAG, "--- onClickView"); + } + if (mState == STATE_SELECT_ON || mState == STATE_SELECTED) { + handleSelect(); + mEST.notifyStateChanged(mMode, mState); + } + } + + public void onStartSelectAll() { + if (DBG) { + Log.d(LOG_TAG, "--- onClickSelectAll"); + } + handleSelectAll(); + mEST.notifyStateChanged(mMode, mState); + } + + public void onFixSelectedItem() { + if (DBG) { + Log.d(LOG_TAG, "--- onClickComplete"); + } + handleComplete(); + mEST.notifyStateChanged(mMode, mState); + } + + public void onInsertImage(Uri uri) { + if (DBG) { + Log.d(LOG_TAG, "--- onInsertImage by URI: " + uri.getPath() + + "," + uri.toString()); + } + int curpos = mEST.getSelectionStart(); + mEST.getText().insert(curpos, "a"); + ImageSpan is = new ImageSpan(mEST.getContext(), uri); + mEST.getText().setSpan(is, + curpos, curpos + 1, + Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + mEST.notifyStateChanged(mMode, mState); + } + + public void onInsertImage(int resID) { + if (DBG) { + Log.d(LOG_TAG, "--- onInsertImage by resID"); + } + int curpos = mEST.getSelectionStart(); + mEST.getText().insert(curpos, "a"); + mEST.getText().setSpan(new ImageSpan(mEST.getContext(), resID), + curpos, curpos + 1, + Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + mEST.notifyStateChanged(mMode, mState); } public void setItemSize(int size) { @@ -428,75 +618,24 @@ public class EditStyledText extends EditText { } } - public void onStartColor() { + public void setAlignment(Layout.Alignment align) { if (DBG) { - Log.d(LOG_TAG, "--- onClickColor"); + Log.d(LOG_TAG, "--- onClickColorItem"); } - handleColor(); - } - - public void onStartSelect() { - if (DBG) { - Log.d(LOG_TAG, "--- onClickSelect"); + if (mState == STATE_SELECTED || mState == STATE_SELECT_FIX) { + changeAlign(align); + handleResetEdit(); } - mMode = MODE_SELECT; - if (mState == STATE_SELECT_OFF) { - handleSelect(); - } else { - offSelect(); - handleSelect(); - } - } - - public void onStartSelectAll() { - if (DBG) { - Log.d(LOG_TAG, "--- onClickSelectAll"); - } - handleSelectAll(); - } - - public void onTouchScreen() { - if (DBG) { - Log.d(LOG_TAG, "--- onClickView"); - } - if (mState == STATE_SELECT_ON || mState == STATE_SELECTED) { - handleSelect(); - } - } - - public void onFixSelectItem() { - if (DBG) { - Log.d(LOG_TAG, "--- onClickComplete"); - } - handleComplete(); - } - - public void onInsertImage(Uri uri) { - if (DBG) { - Log.d(LOG_TAG, "--- onInsertImage by URI: " + uri.getPath() - + "," + uri.toString()); - } - - mEST.getText().append("a"); - mEST.getText().setSpan(new ImageSpan(mEST.getContext(), uri), - mEST.getText().length() - 1, mEST.getText().length(), - Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - } - - public void onInsertImage(int resID) { - if (DBG) { - Log.d(LOG_TAG, "--- onInsertImage by resID"); - } - mEST.getText().append("b"); - mEST.getText().setSpan(new ImageSpan(mEST.getContext(), resID), - mEST.getText().length() - 1, mEST.getText().length(), - Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } public boolean isEditting() { return mEditFlag; } + public boolean isSoftKeyBlocked() { + return this.mSoftKeyBlockFlag; + } + public int getEditMode() { return mMode; } @@ -505,6 +644,42 @@ public class EditStyledText extends EditText { return mState; } + public int getSelectionStart() { + return mCurStart; + } + + public int getSelectionEnd() { + return mCurEnd; + } + + private void doNextHandle() { + if (DBG) { + Log.d(LOG_TAG, "--- doNextHandle: " + mMode + "," + mState); + } + switch (mMode) { + case MODE_COPY: + handleCopy(); + break; + case MODE_CUT: + handleCut(); + break; + case MODE_PASTE: + handlePaste(); + break; + case MODE_SIZE: + handleSize(); + break; + case MODE_COLOR: + handleColor(); + break; + case MODE_ALIGN: + handleAlign(); + break; + default: + break; + } + } + private void handleCancel() { if (DBG) { Log.d(LOG_TAG, "--- handleCancel"); @@ -512,7 +687,9 @@ public class EditStyledText extends EditText { mMode = MODE_NOTHING; mState = STATE_SELECT_OFF; mEditFlag = false; - offSelect(); + Log.d(LOG_TAG, "--- handleCancel:" + mEST.getInputType()); + unblockSoftKey(); + unsetSelect(); } private void handleComplete() { @@ -525,18 +702,32 @@ public class EditStyledText extends EditText { if (mState == STATE_SELECTED) { mState = STATE_SELECT_FIX; } - switch (mMode) { - case MODE_COPY: - handleCopy(); - break; - case MODE_COLOR: - handleColor(); - break; - case MODE_SIZE: - handleSize(); - break; - default: - break; + doNextHandle(); + } + + private void handleTextViewFunc(int mode, int id) { + if (DBG) { + Log.d(LOG_TAG, "--- handleTextView: " + mMode + "," + mState + + "," + id); + } + if (!mEditFlag) { + return; + } + if (mMode == MODE_NOTHING || mMode == MODE_SELECT) { + mMode = mode; + if (mState == STATE_SELECTED) { + mState = STATE_SELECT_FIX; + handleTextViewFunc(mode, id); + } else { + handleSelect(); + } + } else if (mMode != mode) { + handleCancel(); + mMode = mode; + handleTextViewFunc(mode, id); + } else if (mState == STATE_SELECT_FIX) { + mEST.onTextContextMenuItem(id); + handleResetEdit(); } } @@ -544,26 +735,14 @@ public class EditStyledText extends EditText { if (DBG) { Log.d(LOG_TAG, "--- handleCopy: " + mMode + "," + mState); } - if (!mEditFlag) { - return; - } - if (mMode == MODE_NOTHING || mMode == MODE_SELECT) { - mMode = MODE_COPY; - if (mState == STATE_SELECTED) { - mState = STATE_SELECT_FIX; - storeSelectedText(); - } else { - handleSelect(); - } - } else if (mMode != MODE_COPY) { - handleCancel(); - mMode = MODE_COPY; - handleCopy(); - } else if (mState == STATE_SELECT_FIX) { - mEST.setHintMessage(HINT_MSG_NULL); - storeSelectedText(); - handleResetEdit(); + handleTextViewFunc(MODE_COPY, android.R.id.copy); + } + + private void handleCut() { + if (DBG) { + Log.d(LOG_TAG, "--- handleCopy: " + mMode + "," + mState); } + handleTextViewFunc(MODE_CUT, android.R.id.cut); } private void handlePaste() { @@ -573,72 +752,63 @@ public class EditStyledText extends EditText { if (!mEditFlag) { return; } - if (mTextSelectBuffer != null && mTextCopyBufer.length() > 0) { - mTextSelectBuffer.insert(mEST.getSelectionStart(), - mTextCopyBufer); + mEST.onTextContextMenuItem(android.R.id.paste); + } + + private void handleSetSpan(int mode) { + if (DBG) { + Log.d(LOG_TAG, "--- handleSetSpan:" + mEditFlag + "," + + mState + ',' + mMode); + } + if (!mEditFlag) { + Log.e(LOG_TAG, "--- handleSetSpan: Editing is not started."); + return; + } + if (mMode == MODE_NOTHING || mMode == MODE_SELECT) { + mMode = mode; + if (mState == STATE_SELECTED) { + mState = STATE_SELECT_FIX; + handleSetSpan(mode); + } else { + handleSelect(); + } + } else if (mMode != mode) { + handleCancel(); + mMode = mode; + handleSetSpan(mode); } else { - mEST.setHintMessage(HINT_MSG_COPY_BUF_BLANK); + if (mState == STATE_SELECT_FIX) { + mEST.setHintMessage(HINT_MSG_NULL); + switch (mode) { + case MODE_COLOR: + mEST.onShowColorAlert(); + break; + case MODE_SIZE: + mEST.onShowSizeAlert(); + break; + case MODE_ALIGN: + mEST.onShowAlignAlert(); + break; + default: + Log.e(LOG_TAG, "--- handleSetSpan: invalid mode."); + break; + } + } else { + Log.d(LOG_TAG, "--- handleSetSpan: do nothing."); + } } } private void handleSize() { - if (DBG) { - Log.d(LOG_TAG, "--- handleSize: " + mMode + "," + mState); - } - if (!mEditFlag) { - Log.e(LOG_TAG, "--- Editing is not started for handlesize."); - return; - } - if (mMode == MODE_NOTHING || mMode == MODE_SELECT) { - mMode = MODE_SIZE; - if (mState == STATE_SELECTED) { - mState = STATE_SELECT_FIX; - handleSize(); - } else { - handleSelect(); - } - } else if (mMode != MODE_SIZE) { - handleCancel(); - mMode = MODE_SIZE; - handleSize(); - } else { - if (mState == STATE_SELECT_FIX) { - mEST.setHintMessage(HINT_MSG_NULL); - mEST.onShowSizeAlert(); - } else { - Log.d(LOG_TAG, "--- handlesize: do nothing"); - } - } + handleSetSpan(MODE_SIZE); } private void handleColor() { - if (DBG) { - Log.d(LOG_TAG, "--- handleSize: " + mMode + "," + mState); - } - if (!mEditFlag) { - Log.e(LOG_TAG, "--- Editing is not started for handlecolor."); - return; - } - if (mMode == MODE_NOTHING || mMode == MODE_SELECT) { - mMode = MODE_COLOR; - if (mState == STATE_SELECTED) { - mState = STATE_SELECT_FIX; - handleColor(); - } else { - handleSelect(); - } - } else if (mMode != MODE_COLOR) { - handleCancel(); - mMode = MODE_COLOR; - handleSize(); - } else { - if (mState == STATE_SELECT_FIX) { - mEST.setHintMessage(HINT_MSG_NULL); - mEST.onShowColorAlert(); - } else { - Log.d(LOG_TAG, "--- handlecolor: do nothing"); - } - } + handleSetSpan(MODE_COLOR); + } + + private void handleAlign() { + handleSetSpan(MODE_ALIGN); } private void handleSelect() { @@ -653,19 +823,20 @@ public class EditStyledText extends EditText { Log.e(LOG_TAG, "Selection is off, but selected"); } setSelectStartPos(); + blockSoftKey(); mEST.setHintMessage(HINT_MSG_SELECT_END); } else if (mState == STATE_SELECT_ON) { if (isTextSelected()) { Log.e(LOG_TAG, "Selection now start, but selected"); } - setSelectEndPos(); + setSelectedEndPos(); mEST.setHintMessage(HINT_MSG_PUSH_COMPETE); doNextHandle(); } else if (mState == STATE_SELECTED) { if (!isTextSelected()) { Log.e(LOG_TAG, "Selection is done, but not selected"); } - setSelectEndPos(); + setSelectedEndPos(); doNextHandle(); } } @@ -678,47 +849,30 @@ public class EditStyledText extends EditText { return; } mEST.selectAll(); - } - - private void doNextHandle() { - if (DBG) { - Log.d(LOG_TAG, "--- doNextHandle: " + mMode + "," + mState); - } - switch (mMode) { - case MODE_COPY: - handleCopy(); - break; - case MODE_PASTE: - handlePaste(); - break; - case MODE_SIZE: - handleSize(); - break; - case MODE_COLOR: - handleColor(); - break; - default: - break; - } + mState = STATE_SELECTED; } private void handleResetEdit() { if (DBG) { Log.d(LOG_TAG, "Reset Editor"); } + blockSoftKey(); handleCancel(); mEditFlag = true; mEST.setHintMessage(HINT_MSG_SELECT_START); } - // Methods of selection - private void onSelect() { + private void setSelection() { if (DBG) { Log.d(LOG_TAG, "--- onSelect:" + mCurStart + "," + mCurEnd); } if (mCurStart >= 0 && mCurStart <= mEST.getText().length() && mCurEnd >= 0 && mCurEnd <= mEST.getText().length()) { - mEST.setSelection(mCurStart, mCurEnd); + if (mCurStart < mCurEnd) { + mEST.setSelection(mCurStart, mCurEnd); + } else { + mEST.setSelection(mCurEnd, mCurStart); + } mState = STATE_SELECTED; } else { Log.e(LOG_TAG, @@ -728,7 +882,7 @@ public class EditStyledText extends EditText { } } - private void offSelect() { + private void unsetSelect() { if (DBG) { Log.d(LOG_TAG, "--- offSelect"); } @@ -745,22 +899,23 @@ public class EditStyledText extends EditText { mState = STATE_SELECT_ON; } - private void setSelectEndPos() { + private void setSelectedEndPos() { if (DBG) { - Log.d(LOG_TAG, "--- setSelectEndPos:" - + mEST.getSelectionStart()); + Log.d(LOG_TAG, "--- setSelectEndPos:"); } - int curpos = mEST.getSelectionStart(); - if (curpos < mCurStart) { - if (DBG) { - Log.d(LOG_TAG, "--- setSelectEndPos: swap is done."); - } - mCurEnd = mCurStart; - mCurStart = curpos; + if (mEST.getSelectionStart() == mCurStart) { + setSelectedEndPos(mEST.getSelectionEnd()); } else { - mCurEnd = curpos; + setSelectedEndPos(mEST.getSelectionStart()); } - onSelect(); + } + + public void setSelectedEndPos(int pos) { + if (DBG) { + Log.d(LOG_TAG, "--- setSelectedEndPos:"); + } + mCurEnd = pos; + setSelection(); } private boolean isTextSelected() { @@ -773,30 +928,96 @@ public class EditStyledText extends EditText { mState == STATE_SELECT_FIX); } - private void storeSelectedText() { + private void setStyledTextSpan(Object span, int start, int end) { if (DBG) { - Log.d(LOG_TAG, "--- storeSelectedText"); + Log.d(LOG_TAG, "--- setStyledTextSpan:" + mMode + "," + + start + "," + end); + } + if (start < end) { + mEST.getText().setSpan(span, start, end, + Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + } else { + mEST.getText().setSpan(span, end, start, + Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } - mTextSelectBuffer = mEST.getText(); - mTextCopyBufer = mTextSelectBuffer.subSequence(mCurStart, mCurEnd); } private void changeSizeSelectedText(int size) { if (DBG) { - Log.d(LOG_TAG, "--- changeSizeSelectedText:" + size + "," - + mCurStart + "," + mCurEnd); + Log.d(LOG_TAG, "--- changeAlign:" + size); } - mEST.getText().setSpan(new AbsoluteSizeSpan(size), mCurStart, - mCurEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + setStyledTextSpan(new AbsoluteSizeSpan(size), + mCurStart, mCurEnd); } private void changeColorSelectedText(int color) { if (DBG) { - Log.d(LOG_TAG, "--- changeCollorSelectedText:" + color + "," - + mCurStart + "," + mCurEnd); + Log.d(LOG_TAG, "--- changeAlign:" + color); } - mEST.getText().setSpan(new ForegroundColorSpan(color), mCurStart, - mCurEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + setStyledTextSpan(new ForegroundColorSpan(color), + mCurStart, mCurEnd); + } + + private void changeAlign(Layout.Alignment align) { + if (DBG) { + Log.d(LOG_TAG, "--- changeAlign:" + align); + } + setStyledTextSpan(new AlignmentSpan.Standard(align), + findLineStart(mEST.getText(), mCurStart), + findLineEnd(mEST.getText(), mCurEnd)); + } + + private int findLineStart(Editable text, int current) { + if (DBG) { + Log.d(LOG_TAG, "--- findLineStart: curr:" + current + + ", length:" + text.length()); + } + int pos = current; + for (; pos > 0; pos--) { + if (text.charAt(pos - 1) == '\n') { + break; + } + } + return pos; + } + + private int findLineEnd(Editable text, int current) { + if (DBG) { + Log.d(LOG_TAG, "--- findLineEnd: curr:" + current + + ", length:" + text.length()); + } + int pos = current; + for (; pos < text.length(); pos++) { + if (pos > 0 && text.charAt(pos - 1) == '\n') { + break; + } + } + return pos; + } + + private void blockSoftKey() { + if (DBG) { + Log.d(LOG_TAG, "--- blockSoftKey:"); + } + InputMethodManager imm = (InputMethodManager) mEST.getContext(). + getSystemService(Context.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(mEST.getWindowToken(), 0); + mEST.setOnClickListener( + new OnClickListener() { + public void onClick(View v) { + Log.d(LOG_TAG, "--- ontrackballclick:"); + onFixSelectedItem(); + } + }); + mSoftKeyBlockFlag = true; + } + + private void unblockSoftKey() { + if (DBG) { + Log.d(LOG_TAG, "--- unblockSoftKey:"); + } + mEST.setOnClickListener(null); + this.mSoftKeyBlockFlag = false; } } @@ -809,19 +1030,45 @@ public class EditStyledText extends EditText { public String getConvertedBody() { String htmlBody = Html.toHtml(mEST.getText()); + if (DBG) { + Log.d(LOG_TAG, "--- getConvertedBody:" + htmlBody); + } return htmlBody; } + + public void getUriArray(ArrayList uris, Editable text) { + uris.clear(); + if (DBG) { + Log.d(LOG_TAG, "--- getUriArray:"); + } + int len = text.length(); + int next; + for (int i = 0; i < text.length(); i = next) { + next = text.nextSpanTransition(i, len, ImageSpan.class); + ImageSpan[] images = text.getSpans(i, next, ImageSpan.class); + for (int j = 0; j < images.length; j++) { + if (DBG) { + Log.d(LOG_TAG, "--- getUriArray: foundArray" + + ((ImageSpan) images[j]).getSource()); + } + uris.add(Uri.parse( + ((ImageSpan) images[j]).getSource())); + } + } + } } private class StyledTextToast { Builder mBuilder; CharSequence mColorTitle; CharSequence mSizeTitle; + CharSequence mAlignTitle; CharSequence[] mColorNames; CharSequence[] mColorInts; CharSequence[] mSizeNames; CharSequence[] mSizeDisplayInts; CharSequence[] mSizeSendInts; + CharSequence[] mAlignNames; EditStyledText mEST; public StyledTextToast(EditStyledText est) { @@ -848,6 +1095,12 @@ public class EditStyledText extends EditText { mSizeSendInts = sizesendints; } + public void setAlignAlertParams(CharSequence aligntitle, + CharSequence[] alignnames) { + mAlignTitle = aligntitle; + mAlignNames = alignnames; + } + public boolean checkColorAlertParams() { if (DBG) { Log.d(LOG_TAG, "--- checkParams"); @@ -873,13 +1126,30 @@ public class EditStyledText extends EditText { } if (mBuilder == null) { Log.e(LOG_TAG, "--- builder is null."); + return false; } else if (mSizeTitle == null || mSizeNames == null || mSizeDisplayInts == null || mSizeSendInts == null) { Log.e(LOG_TAG, "--- size alert params are null."); + return false; } else if (mSizeNames.length != mSizeDisplayInts.length && mSizeSendInts.length != mSizeDisplayInts.length) { Log.e(LOG_TAG, "--- the length of size alert params are " + "different."); + return false; + } + return true; + } + + public boolean checkAlignAlertParams() { + if (DBG) { + Log.d(LOG_TAG, "--- checkAlignAlertParams"); + } + if (mBuilder == null) { + Log.e(LOG_TAG, "--- builder is null."); + return false; + } else if (mAlignTitle == null) { + Log.e(LOG_TAG, "--- align alert params are null."); + return false; } return true; } @@ -919,7 +1189,7 @@ public class EditStyledText extends EditText { setItems(mSizeNames, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { - Log.d("EETVM", "mBuilder.onclick:" + which); + Log.d(LOG_TAG, "mBuilder.onclick:" + which); int size = Integer .parseInt((String) mSizeDisplayInts[which]); mEST.setItemSize(size); @@ -927,5 +1197,165 @@ public class EditStyledText extends EditText { }); mBuilder.show(); } + + private void onShowAlignAlertDialog() { + if (DBG) { + Log.d(LOG_TAG, "--- onShowAlertDialog"); + } + if (!checkAlignAlertParams()) { + return; + } + mBuilder.setTitle(mAlignTitle); + mBuilder.setIcon(0); + mBuilder. + setItems(mAlignNames, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + Log.d(LOG_TAG, "mBuilder.onclick:" + which); + Layout.Alignment align = Layout.Alignment.ALIGN_NORMAL; + switch (which) { + case 0: + align = Layout.Alignment.ALIGN_NORMAL; + break; + case 1: + align = Layout.Alignment.ALIGN_CENTER; + break; + case 2: + align = Layout.Alignment.ALIGN_OPPOSITE; + break; + default: + break; + } + mEST.setAlignment(align); + } + }); + mBuilder.show(); + } + } + + private class StyledTextArrowKeyMethod extends ArrowKeyMovementMethod { + EditorManager mManager; + StyledTextArrowKeyMethod(EditorManager manager) { + super(); + mManager = manager; + } + + @Override + public boolean onKeyDown(TextView widget, Spannable buffer, + int keyCode, KeyEvent event) { + if (!mManager.isSoftKeyBlocked()) { + return super.onKeyDown(widget, buffer, keyCode, event); + } + if (executeDown(widget, buffer, keyCode)) { + return true; + } + return false; + } + + private int getEndPos(TextView widget) { + int end; + if (widget.getSelectionStart() == mManager.getSelectionStart()) { + end = widget.getSelectionEnd(); + } else { + end = widget.getSelectionStart(); + } + return end; + } + + private boolean up(TextView widget, Spannable buffer) { + if (DBG) { + Log.d(LOG_TAG, "--- up:"); + } + Layout layout = widget.getLayout(); + int end = getEndPos(widget); + int line = layout.getLineForOffset(end); + if (line > 0) { + int to; + if (layout.getParagraphDirection(line) == + layout.getParagraphDirection(line - 1)) { + float h = layout.getPrimaryHorizontal(end); + to = layout.getOffsetForHorizontal(line - 1, h); + } else { + to = layout.getLineStart(line - 1); + } + mManager.setSelectedEndPos(to); + mManager.onCursorMoved(); + return true; + } + return false; + } + + private boolean down(TextView widget, Spannable buffer) { + if (DBG) { + Log.d(LOG_TAG, "--- down:"); + } + Layout layout = widget.getLayout(); + int end = getEndPos(widget); + int line = layout.getLineForOffset(end); + if (line < layout.getLineCount() - 1) { + int to; + if (layout.getParagraphDirection(line) == + layout.getParagraphDirection(line + 1)) { + float h = layout.getPrimaryHorizontal(end); + to = layout.getOffsetForHorizontal(line + 1, h); + } else { + to = layout.getLineStart(line + 1); + } + mManager.setSelectedEndPos(to); + mManager.onCursorMoved(); + return true; + } + return false; + } + + private boolean left(TextView widget, Spannable buffer) { + if (DBG) { + Log.d(LOG_TAG, "--- left:"); + } + Layout layout = widget.getLayout(); + int to = layout.getOffsetToLeftOf(getEndPos(widget)); + mManager.setSelectedEndPos(to); + mManager.onCursorMoved(); + return true; + } + + private boolean right(TextView widget, Spannable buffer) { + if (DBG) { + Log.d(LOG_TAG, "--- right:"); + } + Layout layout = widget.getLayout(); + int to = layout.getOffsetToRightOf(getEndPos(widget)); + mManager.setSelectedEndPos(to); + mManager.onCursorMoved(); + return true; + } + + private boolean executeDown(TextView widget, Spannable buffer, + int keyCode) { + if (DBG) { + Log.d(LOG_TAG, "--- executeDown: " + keyCode); + } + boolean handled = false; + + switch (keyCode) { + case KeyEvent.KEYCODE_DPAD_UP: + handled |= up(widget, buffer); + break; + case KeyEvent.KEYCODE_DPAD_DOWN: + handled |= down(widget, buffer); + break; + case KeyEvent.KEYCODE_DPAD_LEFT: + handled |= left(widget, buffer); + break; + case KeyEvent.KEYCODE_DPAD_RIGHT: + handled |= right(widget, buffer); + break; + case KeyEvent.KEYCODE_DPAD_CENTER: + mManager.onFixSelectedItem(); + handled = true; + break; + } + return handled; + } } } diff --git a/core/java/com/android/internal/widget/EditableInputConnection.java b/core/java/com/android/internal/widget/EditableInputConnection.java index f2ec0649860c5..ad329d18db54e 100644 --- a/core/java/com/android/internal/widget/EditableInputConnection.java +++ b/core/java/com/android/internal/widget/EditableInputConnection.java @@ -33,7 +33,7 @@ public class EditableInputConnection extends BaseInputConnection { private final TextView mTextView; public EditableInputConnection(TextView textview) { - super(textview, false); + super(textview, true); mTextView = textview; } diff --git a/core/java/com/google/android/gdata/client/AndroidGDataClient.java b/core/java/com/google/android/gdata/client/AndroidGDataClient.java index fe7d8601c2e02..998f940e63a1d 100644 --- a/core/java/com/google/android/gdata/client/AndroidGDataClient.java +++ b/core/java/com/google/android/gdata/client/AndroidGDataClient.java @@ -51,7 +51,7 @@ public class AndroidGDataClient implements GDataClient { private static final String X_HTTP_METHOD_OVERRIDE = "X-HTTP-Method-Override"; - private static final String USER_AGENT_APP_VERSION = "Android-GData/1.0"; + private static final String DEFAULT_USER_AGENT_APP_VERSION = "Android-GData/1.1"; private static final int MAX_REDIRECTS = 10; @@ -121,7 +121,7 @@ public class AndroidGDataClient implements GDataClient { * @deprecated Use AndroidGDAtaClient(Context) instead. */ public AndroidGDataClient(ContentResolver resolver) { - mHttpClient = new GoogleHttpClient(resolver, USER_AGENT_APP_VERSION, + mHttpClient = new GoogleHttpClient(resolver, DEFAULT_USER_AGENT_APP_VERSION, true /* gzip capable */); mHttpClient.enableCurlLogging(TAG, Log.VERBOSE); mResolver = resolver; @@ -136,7 +136,21 @@ public class AndroidGDataClient implements GDataClient { * SSL session persistence. */ public AndroidGDataClient(Context context) { - mHttpClient = new GoogleHttpClient(context, USER_AGENT_APP_VERSION, + this(context, DEFAULT_USER_AGENT_APP_VERSION); + } + + /** + * Creates a new AndroidGDataClient. + * + * @param context The ContentResolver to get URL rewriting rules from + * through the Android proxy server, using null to indicate not using proxy. + * The context will also be used by GoogleHttpClient for configuration of + * SSL session persistence. + * @param appAndVersion The application name and version to be used as the basis of the + * User-Agent. e.g., Android-GData/1.5.0. + */ + public AndroidGDataClient(Context context, String appAndVersion) { + mHttpClient = new GoogleHttpClient(context, appAndVersion, true /* gzip capable */); mHttpClient.enableCurlLogging(TAG, Log.VERBOSE); mResolver = context.getContentResolver(); diff --git a/core/jni/android_media_JetPlayer.cpp b/core/jni/android_media_JetPlayer.cpp index e345af6213141..3727f4b228ed0 100644 --- a/core/jni/android_media_JetPlayer.cpp +++ b/core/jni/android_media_JetPlayer.cpp @@ -14,8 +14,7 @@ * limitations under the License. */ -//FIXME: remove log before release -#define LOG_NDEBUG 0 +//#define LOG_NDEBUG 0 #define LOG_TAG "JET_JNI" diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 1b145af033f3b..9a569a1a6dd0d 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -797,7 +797,7 @@ + android:protectionLevel="signatureOrSystem" /> + android:protectionLevel="signatureOrSystem" /> @@ -909,7 +909,7 @@ + android:protectionLevel="signatureOrSystem" /> diff --git a/core/res/assets/images/android-logo-mask.png b/core/res/assets/images/android-logo-mask.png new file mode 100644 index 0000000000000..1e8ab95fa99d5 Binary files /dev/null and b/core/res/assets/images/android-logo-mask.png differ diff --git a/core/res/assets/images/android-logo-shine.png b/core/res/assets/images/android-logo-shine.png new file mode 100644 index 0000000000000..60144f1f7ca7c Binary files /dev/null and b/core/res/assets/images/android-logo-shine.png differ diff --git a/core/res/assets/images/android_320x480.png b/core/res/assets/images/android_320x480.png deleted file mode 100644 index d2665bb7221a7..0000000000000 Binary files a/core/res/assets/images/android_320x480.png and /dev/null differ diff --git a/core/res/assets/images/boot_robot.png b/core/res/assets/images/boot_robot.png deleted file mode 100644 index f4555afe7419a..0000000000000 Binary files a/core/res/assets/images/boot_robot.png and /dev/null differ diff --git a/core/res/assets/images/boot_robot_glow.png b/core/res/assets/images/boot_robot_glow.png deleted file mode 100644 index 2a67a3f0c7a45..0000000000000 Binary files a/core/res/assets/images/boot_robot_glow.png and /dev/null differ diff --git a/core/res/assets/images/cylon_dot.png b/core/res/assets/images/cylon_dot.png deleted file mode 100644 index 150b8b162d698..0000000000000 Binary files a/core/res/assets/images/cylon_dot.png and /dev/null differ diff --git a/core/res/assets/images/cylon_left.png b/core/res/assets/images/cylon_left.png deleted file mode 100644 index 50c6296fbafd3..0000000000000 Binary files a/core/res/assets/images/cylon_left.png and /dev/null differ diff --git a/core/res/assets/images/cylon_right.png b/core/res/assets/images/cylon_right.png deleted file mode 100644 index 89b7d719d0bd7..0000000000000 Binary files a/core/res/assets/images/cylon_right.png and /dev/null differ diff --git a/core/res/res/drawable/ic_btn_square_browser_zoom_fit_page_disabled.png b/core/res/res/drawable/ic_btn_square_browser_zoom_fit_page_disabled.png index 326397cbf0365..914662d41c37c 100644 Binary files a/core/res/res/drawable/ic_btn_square_browser_zoom_fit_page_disabled.png and b/core/res/res/drawable/ic_btn_square_browser_zoom_fit_page_disabled.png differ diff --git a/core/res/res/drawable/ic_btn_square_browser_zoom_fit_page_normal.png b/core/res/res/drawable/ic_btn_square_browser_zoom_fit_page_normal.png index 55834010e7ac9..3b67c6d6559fa 100644 Binary files a/core/res/res/drawable/ic_btn_square_browser_zoom_fit_page_normal.png and b/core/res/res/drawable/ic_btn_square_browser_zoom_fit_page_normal.png differ diff --git a/core/res/res/drawable/ic_emergency.png b/core/res/res/drawable/ic_emergency.png index d99abf83e7254..45d0f21736c3d 100755 Binary files a/core/res/res/drawable/ic_emergency.png and b/core/res/res/drawable/ic_emergency.png differ diff --git a/core/res/res/drawable/timepicker_down_disabled.9.png b/core/res/res/drawable/timepicker_down_disabled.9.png index 7d8e0b98352c8..596294b620804 100755 Binary files a/core/res/res/drawable/timepicker_down_disabled.9.png and b/core/res/res/drawable/timepicker_down_disabled.9.png differ diff --git a/core/res/res/drawable/timepicker_down_disabled_focused.9.png b/core/res/res/drawable/timepicker_down_disabled_focused.9.png index 6f2373ea88a1c..662cffd19081c 100755 Binary files a/core/res/res/drawable/timepicker_down_disabled_focused.9.png and b/core/res/res/drawable/timepicker_down_disabled_focused.9.png differ diff --git a/core/res/res/drawable/timepicker_down_normal.9.png b/core/res/res/drawable/timepicker_down_normal.9.png index a9463552ec68c..f17e8f942ac65 100755 Binary files a/core/res/res/drawable/timepicker_down_normal.9.png and b/core/res/res/drawable/timepicker_down_normal.9.png differ diff --git a/core/res/res/drawable/timepicker_down_pressed.9.png b/core/res/res/drawable/timepicker_down_pressed.9.png index fb4d817c48f0c..777bcf5f35c59 100755 Binary files a/core/res/res/drawable/timepicker_down_pressed.9.png and b/core/res/res/drawable/timepicker_down_pressed.9.png differ diff --git a/core/res/res/drawable/timepicker_down_selected.9.png b/core/res/res/drawable/timepicker_down_selected.9.png index 1db8bc1aacf8c..b45db62121d41 100755 Binary files a/core/res/res/drawable/timepicker_down_selected.9.png and b/core/res/res/drawable/timepicker_down_selected.9.png differ diff --git a/core/res/res/drawable/timepicker_up_disabled.9.png b/core/res/res/drawable/timepicker_up_disabled.9.png index 93d0db48326c4..327b0b5ad926c 100755 Binary files a/core/res/res/drawable/timepicker_up_disabled.9.png and b/core/res/res/drawable/timepicker_up_disabled.9.png differ diff --git a/core/res/res/drawable/timepicker_up_disabled_focused.9.png b/core/res/res/drawable/timepicker_up_disabled_focused.9.png index b5bf68d1b7c08..4c96680fefb95 100755 Binary files a/core/res/res/drawable/timepicker_up_disabled_focused.9.png and b/core/res/res/drawable/timepicker_up_disabled_focused.9.png differ diff --git a/core/res/res/drawable/timepicker_up_normal.9.png b/core/res/res/drawable/timepicker_up_normal.9.png index 978251d70ace8..dcd26e0115e0e 100755 Binary files a/core/res/res/drawable/timepicker_up_normal.9.png and b/core/res/res/drawable/timepicker_up_normal.9.png differ diff --git a/core/res/res/drawable/timepicker_up_pressed.9.png b/core/res/res/drawable/timepicker_up_pressed.9.png index 924b03cff0f26..7dac77868749d 100755 Binary files a/core/res/res/drawable/timepicker_up_pressed.9.png and b/core/res/res/drawable/timepicker_up_pressed.9.png differ diff --git a/core/res/res/drawable/timepicker_up_selected.9.png b/core/res/res/drawable/timepicker_up_selected.9.png index 5c94d0dfe5771..35dae8ef11a49 100755 Binary files a/core/res/res/drawable/timepicker_up_selected.9.png and b/core/res/res/drawable/timepicker_up_selected.9.png differ diff --git a/core/res/res/layout/always_use_checkbox.xml b/core/res/res/layout/always_use_checkbox.xml index 5e6e3886facb6..1f8d256d3712a 100644 --- a/core/res/res/layout/always_use_checkbox.xml +++ b/core/res/res/layout/always_use_checkbox.xml @@ -21,7 +21,8 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="14dip" - android:paddingRight="15dip"> + android:paddingRight="15dip" + android:orientation="vertical"> diff --git a/core/res/res/layout/keyguard_screen_lock.xml b/core/res/res/layout/keyguard_screen_lock.xml index 952fc5d9dc60b..b5fbace148614 100644 --- a/core/res/res/layout/keyguard_screen_lock.xml +++ b/core/res/res/layout/keyguard_screen_lock.xml @@ -211,7 +211,7 @@ android:layout_marginTop="5dip" android:layout_gravity="center_horizontal" android:drawableLeft="@drawable/ic_emergency" - android:drawablePadding="3dip" + android:drawablePadding="8dip" android:text="@android:string/lockscreen_emergency_call" /> diff --git a/core/res/res/layout/keyguard_screen_sim_pin_landscape.xml b/core/res/res/layout/keyguard_screen_sim_pin_landscape.xml index 881652ba6cbb9..4c583d84eeb28 100644 --- a/core/res/res/layout/keyguard_screen_sim_pin_landscape.xml +++ b/core/res/res/layout/keyguard_screen_sim_pin_landscape.xml @@ -87,12 +87,7 @@ android:layout_weight="1.0" android:layout_marginBottom="8dip" android:layout_marginRight="8dip" - android:paddingLeft="4dip" - android:paddingRight="4dip" - android:paddingTop="8dip" - android:paddingBottom="8dip" android:textSize="18sp" - android:drawablePadding="3dip" />