diff --git a/api/current.xml b/api/current.xml index f4d81c7b02ac7..b72fea0e91c20 100644 --- a/api/current.xml +++ b/api/current.xml @@ -17299,6 +17299,17 @@ visibility="public" > + + Applications can also register for {@link #ACTION_DISCOVERY_STARTED} * or {@link #ACTION_DISCOVERY_FINISHED} to be notified when discovery * starts or completes. + *

Requires {@link android.Manifest.permission#BLUETOOTH}. * * @return true if discovering */ @@ -582,6 +583,7 @@ public final class BluetoothAdapter { /** * Return the set of {@link BluetoothDevice} objects that are bonded * (paired) to the local adapter. + *

Requires {@link android.Manifest.permission#BLUETOOTH}. * * @return unmodifiable set of {@link BluetoothDevice}, or null on error */ diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index 39a74acee888e..849e6c7b24641 100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -513,6 +513,7 @@ public final class BluetoothDevice implements Parcelable { /** * Get trust state of a remote device. + *

Requires {@link android.Manifest.permission#BLUETOOTH}. * @hide */ public boolean getTrustState() { @@ -526,6 +527,7 @@ public final class BluetoothDevice implements Parcelable { /** * Set trust state for a remote device. + *

Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN}. * @param value the trust state value (true or false) * @hide */ @@ -657,6 +659,8 @@ public final class BluetoothDevice implements Parcelable { * Call #connect on the returned #BluetoothSocket to begin the connection. * The remote device will not be authenticated and communication on this * socket will not be encrypted. + *

Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} + * * @param port remote port * @return An RFCOMM BluetoothSocket * @throws IOException On error, for example Bluetooth not available, or @@ -671,6 +675,8 @@ public final class BluetoothDevice implements Parcelable { /** * Construct a SCO socket ready to start an outgoing connection. * Call #connect on the returned #BluetoothSocket to begin the connection. + *

Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} + * * @return a SCO BluetoothSocket * @throws IOException on error, for example Bluetooth not available, or * insufficient permissions. diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java index e5e6db958bb4a..538e51ab974f5 100644 --- a/core/java/android/net/MobileDataStateTracker.java +++ b/core/java/android/net/MobileDataStateTracker.java @@ -48,6 +48,7 @@ public class MobileDataStateTracker extends NetworkStateTracker { private ITelephony mPhoneService; private String mApnType; + private String mApnName; private boolean mEnabled; private BroadcastReceiver mStateReceiver; @@ -139,6 +140,7 @@ public class MobileDataStateTracker extends NetworkStateTracker { String reason = intent.getStringExtra(Phone.STATE_CHANGE_REASON_KEY); String apnName = intent.getStringExtra(Phone.DATA_APN_KEY); String apnTypeList = intent.getStringExtra(Phone.DATA_APN_TYPES_KEY); + mApnName = apnName; boolean unavailable = intent.getBooleanExtra(Phone.NETWORK_UNAVAILABLE_KEY, false); @@ -339,6 +341,7 @@ public class MobileDataStateTracker extends NetworkStateTracker { intent.putExtra(Phone.STATE_KEY, Phone.DataState.CONNECTED.toString()); intent.putExtra(Phone.STATE_CHANGE_REASON_KEY, Phone.REASON_APN_CHANGED); intent.putExtra(Phone.DATA_APN_TYPES_KEY, mApnType); + intent.putExtra(Phone.DATA_APN_KEY, mApnName); intent.putExtra(Phone.DATA_IFACE_NAME_KEY, mInterfaceName); intent.putExtra(Phone.NETWORK_UNAVAILABLE_KEY, false); if (mStateReceiver != null) mStateReceiver.onReceive(mContext, intent); diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 2ca17f6f43bdf..8c9581d0e1cce 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -3620,6 +3620,11 @@ public final class Settings { */ public static final String SEND_ACTION_APP_ERROR = "send_action_app_error"; + /** + * Maximum size of /proc/last_kmsg content to upload after reboot. + */ + public static final String LAST_KMSG_KB = "last_kmsg_kb"; + /** * @deprecated * @hide diff --git a/core/java/android/server/BluetoothA2dpService.java b/core/java/android/server/BluetoothA2dpService.java index b73e53ffca838..9a2d6d94a9348 100644 --- a/core/java/android/server/BluetoothA2dpService.java +++ b/core/java/android/server/BluetoothA2dpService.java @@ -72,6 +72,8 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { private final AudioManager mAudioManager; private final BluetoothService mBluetoothService; private final BluetoothAdapter mAdapter; + private boolean mSuspending; + private boolean mResuming; private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override @@ -149,6 +151,8 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { if (mBluetoothService.isEnabled()) onBluetoothEnable(); + mSuspending = false; + mResuming = false; } @Override @@ -241,6 +245,7 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { } } mAudioManager.setParameters(BLUETOOTH_ENABLED+"=true"); + mAudioManager.setParameters("A2dpSuspended=false"); } private synchronized void onBluetoothDisable() { @@ -336,7 +341,10 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { public synchronized boolean suspendSink(BluetoothDevice device) { mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission"); - if (DBG) log("suspendSink(" + device + ")"); + if (DBG) log("suspendSink(" + device + "), mSuspending: "+mSuspending+", mResuming: "+mResuming); + if (mSuspending) { + return true; + } if (device == null || mAudioDevices == null) { return false; } @@ -347,9 +355,14 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { } switch (state.intValue()) { case BluetoothA2dp.STATE_CONNECTED: + if (mResuming) { + mSuspending = true; + } return true; case BluetoothA2dp.STATE_PLAYING: - return suspendSinkNative(path); + mAudioManager.setParameters("A2dpSuspended=true"); + mSuspending = suspendSinkNative(path); + return mSuspending; default: return false; } @@ -358,7 +371,10 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { public synchronized boolean resumeSink(BluetoothDevice device) { mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission"); - if (DBG) log("resumeSink(" + device + ")"); + if (DBG) log("resumeSink(" + device + "), mResuming: "+mResuming+", mSuspending: "+mSuspending); + if (mResuming) { + return true; + } if (device == null || mAudioDevices == null) { return false; } @@ -369,9 +385,14 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { } switch (state.intValue()) { case BluetoothA2dp.STATE_PLAYING: + if (mSuspending) { + mResuming = true; + } return true; case BluetoothA2dp.STATE_CONNECTED: - return resumeSinkNative(path); + mResuming = resumeSinkNative(path); + mAudioManager.setParameters("A2dpSuspended=false"); + return mResuming; default: return false; } @@ -437,6 +458,10 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { } private void handleSinkStateChange(BluetoothDevice device, int prevState, int state) { + if (state == BluetoothA2dp.STATE_DISCONNECTED) { + mSuspending = false; + mResuming = false; + } if (state != prevState) { if (state == BluetoothA2dp.STATE_DISCONNECTED || state == BluetoothA2dp.STATE_DISCONNECTING) { @@ -452,6 +477,29 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { } mAudioDevices.put(device, state); + if (state == BluetoothA2dp.STATE_CONNECTED && prevState == BluetoothA2dp.STATE_PLAYING) { + if (DBG) log("handleSinkStateChange() STATE_PLAYING -> STATE_CONNECTED: mSuspending: " + +mSuspending+", mResuming: "+mResuming); + if (mSuspending) { + mSuspending = false; + if (mResuming) { + mResuming = false; + resumeSink(device); + } + } + } + if (state == BluetoothA2dp.STATE_PLAYING && prevState == BluetoothA2dp.STATE_CONNECTED) { + if (DBG) log("handleSinkStateChange() STATE_CONNECTED -> STATE_PLAYING: mSuspending: " + +mSuspending+", mResuming: "+mResuming); + + if (mResuming) { + mResuming = false; + if (mSuspending) { + mSuspending = false; + suspendSink(device); + } + } + } Intent intent = new Intent(BluetoothA2dp.ACTION_SINK_STATE_CHANGED); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.putExtra(BluetoothA2dp.EXTRA_PREVIOUS_SINK_STATE, prevState); diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java index 7ebd91dd4d741..5c8c7cc66c8df 100644 --- a/core/java/android/server/BluetoothService.java +++ b/core/java/android/server/BluetoothService.java @@ -61,7 +61,7 @@ import java.util.Map; public class BluetoothService extends IBluetooth.Stub { private static final String TAG = "BluetoothService"; - private static final boolean DBG = true; + private static final boolean DBG = false; private int mNativeData; private BluetoothEventLoop mEventLoop; @@ -191,10 +191,10 @@ public class BluetoothService extends IBluetooth.Stub { /** * Bring down bluetooth. Returns true on success. * - * @param saveSetting If true, disable BT in settings + * @param saveSetting If true, persist the new setting */ public synchronized boolean disable(boolean saveSetting) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission"); switch (mBluetoothState) { case BluetoothAdapter.STATE_OFF: @@ -1013,7 +1013,8 @@ public class BluetoothService extends IBluetooth.Stub { */ public synchronized boolean setTrust(String address, boolean value) { if (!BluetoothAdapter.checkBluetoothAddress(address)) { - mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); return false; } diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java index e233a02800654..9456ae14ca31c 100644 --- a/core/java/android/webkit/BrowserFrame.java +++ b/core/java/android/webkit/BrowserFrame.java @@ -16,6 +16,7 @@ package android.webkit; +import android.app.ActivityManager; import android.content.Context; import android.content.res.AssetManager; import android.graphics.Bitmap; @@ -105,7 +106,13 @@ class BrowserFrame extends Handler { if (sJavaBridge == null) { sJavaBridge = new JWebCoreJavaBridge(context); // set WebCore native cache size - sJavaBridge.setCacheSize(4 * 1024 * 1024); + ActivityManager am = (ActivityManager) context + .getSystemService(Context.ACTIVITY_SERVICE); + if (am.getMemoryClass() > 16) { + sJavaBridge.setCacheSize(8 * 1024 * 1024); + } else { + sJavaBridge.setCacheSize(4 * 1024 * 1024); + } // initialize CacheManager CacheManager.init(context); // create CookieSyncManager with current Context diff --git a/core/java/com/android/internal/widget/RotarySelector.java b/core/java/com/android/internal/widget/RotarySelector.java index e103a5b07d9ec..a2a38dcc9b510 100644 --- a/core/java/com/android/internal/widget/RotarySelector.java +++ b/core/java/com/android/internal/widget/RotarySelector.java @@ -106,8 +106,8 @@ public class RotarySelector extends View { // Vibration (haptic feedback) private Vibrator mVibrator; - private static final long VIBRATE_SHORT = 30; // msec - private static final long VIBRATE_LONG = 60; // msec + private static final long VIBRATE_SHORT = 20; // msec + private static final long VIBRATE_LONG = 20; // msec /** * The drawable for the arrows need to be scrunched this many dips towards the rotary bg below diff --git a/core/res/res/anim/lock_screen_behind_enter.xml b/core/res/res/anim/lock_screen_behind_enter.xml index 9e03e15ab966a..b2432232ab31e 100644 --- a/core/res/res/anim/lock_screen_behind_enter.xml +++ b/core/res/res/anim/lock_screen_behind_enter.xml @@ -19,5 +19,5 @@ + android:duration="@android:integer/config_longAnimTime" /> diff --git a/core/res/res/anim/lock_screen_exit.xml b/core/res/res/anim/lock_screen_exit.xml index 0d329216f5d2b..58bc6dbf0f7ee 100644 --- a/core/res/res/anim/lock_screen_exit.xml +++ b/core/res/res/anim/lock_screen_exit.xml @@ -19,5 +19,5 @@ + android:duration="@android:integer/config_longAnimTime" /> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 6fd7657979023..c87a11c6de539 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -35,10 +35,10 @@ 150 - 200 + 300 - 350 + 400 diff --git a/libs/audioflinger/A2dpAudioInterface.cpp b/libs/audioflinger/A2dpAudioInterface.cpp index 57a29f2dc001f..351815bdb440a 100644 --- a/libs/audioflinger/A2dpAudioInterface.cpp +++ b/libs/audioflinger/A2dpAudioInterface.cpp @@ -16,7 +16,7 @@ #include -#define LOG_NDEBUG 0 +//#define LOG_NDEBUG 0 #define LOG_TAG "A2dpAudioInterface" #include #include @@ -40,7 +40,7 @@ namespace android { //} A2dpAudioInterface::A2dpAudioInterface(AudioHardwareInterface* hw) : - mOutput(0), mHardwareInterface(hw), mBluetoothEnabled(true) + mOutput(0), mHardwareInterface(hw), mBluetoothEnabled(true), mSuspended(false) { } @@ -78,6 +78,7 @@ AudioStreamOut* A2dpAudioInterface::openOutputStream( if ((err = out->set(devices, format, channels, sampleRate)) == NO_ERROR) { mOutput = out; mOutput->setBluetoothEnabled(mBluetoothEnabled); + mOutput->setSuspended(mSuspended); } else { delete out; } @@ -142,6 +143,14 @@ status_t A2dpAudioInterface::setParameters(const String8& keyValuePairs) } param.remove(key); } + key = String8("A2dpSuspended"); + if (param.get(key, value) == NO_ERROR) { + mSuspended = (value == "true"); + if (mOutput) { + mOutput->setSuspended(mSuspended); + } + param.remove(key); + } if (param.size()) { status_t hwStatus = mHardwareInterface->setParameters(param.toString()); @@ -166,6 +175,12 @@ String8 A2dpAudioInterface::getParameters(const String8& keys) a2dpParam.add(key, value); param.remove(key); } + key = "A2dpSuspended"; + if (param.get(key, value) == NO_ERROR) { + value = mSuspended ? "true" : "false"; + a2dpParam.add(key, value); + param.remove(key); + } String8 keyValuePairs = a2dpParam.toString(); @@ -204,7 +219,7 @@ A2dpAudioInterface::A2dpAudioStreamOut::A2dpAudioStreamOut() : mFd(-1), mStandby(true), mStartCount(0), mRetryCount(0), mData(NULL), // assume BT enabled to start, this is safe because its only the // enabled->disabled transition we are worried about - mBluetoothEnabled(true), mDevice(0), mClosing(false) + mBluetoothEnabled(true), mDevice(0), mClosing(false), mSuspended(false) { // use any address by default strcpy(mA2dpAddress, "00:00:00:00:00:00"); @@ -258,8 +273,10 @@ ssize_t A2dpAudioInterface::A2dpAudioStreamOut::write(const void* buffer, size_t size_t remaining = bytes; status_t status = -1; - if (!mBluetoothEnabled || mClosing) { - LOGW("A2dpAudioStreamOut::write(), but bluetooth disabled"); + if (!mBluetoothEnabled || mClosing || mSuspended) { + LOGV("A2dpAudioStreamOut::write(), but bluetooth disabled \ + mBluetoothEnabled %d, mClosing %d, mSuspended %d", + mBluetoothEnabled, mClosing, mSuspended); goto Error; } @@ -408,6 +425,14 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::setBluetoothEnabled(bool enable return NO_ERROR; } +status_t A2dpAudioInterface::A2dpAudioStreamOut::setSuspended(bool onOff) +{ + LOGV("setSuspended %d", onOff); + mSuspended = onOff; + standby(); + return NO_ERROR; +} + status_t A2dpAudioInterface::A2dpAudioStreamOut::close() { Mutex::Autolock lock(mLock); diff --git a/libs/audioflinger/A2dpAudioInterface.h b/libs/audioflinger/A2dpAudioInterface.h index 35a6e1188b7d3..530e432c6a4af 100644 --- a/libs/audioflinger/A2dpAudioInterface.h +++ b/libs/audioflinger/A2dpAudioInterface.h @@ -101,6 +101,7 @@ private: status_t close_l(); status_t setAddress(const char* address); status_t setBluetoothEnabled(bool enabled); + status_t setSuspended(bool onOff); private: int mFd; @@ -113,6 +114,7 @@ private: bool mBluetoothEnabled; uint32_t mDevice; bool mClosing; + bool mSuspended; }; friend class A2dpAudioStreamOut; @@ -121,6 +123,7 @@ private: AudioHardwareInterface *mHardwareInterface; char mA2dpAddress[20]; bool mBluetoothEnabled; + bool mSuspended; }; diff --git a/location/java/android/location/ILocationProvider.aidl b/location/java/android/location/ILocationProvider.aidl index 4fe049462bddc..7da16e455fd16 100644 --- a/location/java/android/location/ILocationProvider.aidl +++ b/location/java/android/location/ILocationProvider.aidl @@ -17,6 +17,7 @@ package android.location; import android.location.Location; +import android.net.NetworkInfo; import android.os.Bundle; /** @@ -41,7 +42,7 @@ interface ILocationProvider { long getStatusUpdateTime(); void enableLocationTracking(boolean enable); void setMinTime(long minTime); - void updateNetworkState(int state); + void updateNetworkState(int state, in NetworkInfo info); void updateLocation(in Location location); boolean sendExtraCommand(String command, inout Bundle extras); void addListener(int uid); diff --git a/location/java/com/android/internal/location/GpsLocationProvider.java b/location/java/com/android/internal/location/GpsLocationProvider.java index bfa067109aa22..cd62ed196e6ce 100755 --- a/location/java/com/android/internal/location/GpsLocationProvider.java +++ b/location/java/com/android/internal/location/GpsLocationProvider.java @@ -32,6 +32,7 @@ import android.location.Location; import android.location.LocationManager; import android.location.LocationProvider; import android.net.ConnectivityManager; +import android.net.NetworkInfo; import android.net.SntpClient; import android.os.Bundle; import android.os.IBinder; @@ -46,7 +47,6 @@ import android.util.SparseIntArray; import com.android.internal.app.IBatteryStats; import com.android.internal.telephony.Phone; -import com.android.internal.telephony.TelephonyIntents; import com.android.internal.location.GpsNetInitiatedHandler; import com.android.internal.location.GpsNetInitiatedHandler.GpsNiNotification; @@ -303,22 +303,6 @@ public class GpsLocationProvider extends ILocationProvider.Stub { } else if (action.equals(ALARM_TIMEOUT)) { if (DEBUG) Log.d(TAG, "ALARM_TIMEOUT"); hibernate(); - } else if (action.equals(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED)) { - String state = intent.getStringExtra(Phone.STATE_KEY); - String apnName = intent.getStringExtra(Phone.DATA_APN_KEY); - String reason = intent.getStringExtra(Phone.STATE_CHANGE_REASON_KEY); - - if (Config.LOGD) { - Log.d(TAG, "state: " + state + " apnName: " + apnName + " reason: " + reason); - } - // FIXME - might not have an APN on CDMA - if ("CONNECTED".equals(state) && apnName != null && apnName.length() > 0) { - mAGpsApn = apnName; - if (mAGpsDataConnectionState == AGPS_DATA_CONNECTION_OPENING) { - native_agps_data_conn_open(mAGpsApn); - mAGpsDataConnectionState = AGPS_DATA_CONNECTION_OPEN; - } - } } } }; @@ -343,7 +327,6 @@ public class GpsLocationProvider extends ILocationProvider.Stub { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(ALARM_WAKEUP); intentFilter.addAction(ALARM_TIMEOUT); - intentFilter.addAction(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED); context.registerReceiver(mBroadcastReciever, intentFilter); mConnMgr = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); @@ -391,13 +374,30 @@ public class GpsLocationProvider extends ILocationProvider.Stub { return true; } - public void updateNetworkState(int state) { + public void updateNetworkState(int state, NetworkInfo info) { mNetworkAvailable = (state == LocationProvider.AVAILABLE); if (Config.LOGD) { - Log.d(TAG, "updateNetworkState " + (mNetworkAvailable ? "available" : "unavailable")); + Log.d(TAG, "updateNetworkState " + (mNetworkAvailable ? "available" : "unavailable") + + " info: " + info); } - + + if (info != null && info.getType() == ConnectivityManager.TYPE_MOBILE_SUPL + && mAGpsDataConnectionState == AGPS_DATA_CONNECTION_OPENING) { + String apnName = info.getExtraInfo(); + if (mNetworkAvailable && apnName != null && apnName.length() > 0) { + mAGpsApn = apnName; + if (DEBUG) Log.d(TAG, "call native_agps_data_conn_open"); + native_agps_data_conn_open(apnName); + mAGpsDataConnectionState = AGPS_DATA_CONNECTION_OPEN; + } else { + if (DEBUG) Log.d(TAG, "call native_agps_data_conn_failed"); + mAGpsApn = null; + mAGpsDataConnectionState = AGPS_DATA_CONNECTION_CLOSED; + native_agps_data_conn_failed(); + } + } + if (mNetworkAvailable && mNetworkThread != null && mEnabled) { // signal the network thread when the network becomes available mNetworkThread.signal(); diff --git a/location/java/com/android/internal/location/LocationProviderProxy.java b/location/java/com/android/internal/location/LocationProviderProxy.java index 4ae424a9b4863..89337b369d6f3 100644 --- a/location/java/com/android/internal/location/LocationProviderProxy.java +++ b/location/java/com/android/internal/location/LocationProviderProxy.java @@ -20,6 +20,7 @@ import android.location.Address; import android.location.ILocationProvider; import android.location.Location; import android.location.LocationManager; +import android.net.NetworkInfo; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; @@ -217,9 +218,9 @@ public class LocationProviderProxy implements IBinder.DeathRecipient { } } - public void updateNetworkState(int state) { + public void updateNetworkState(int state, NetworkInfo info) { try { - mProvider.updateNetworkState(state); + mProvider.updateNetworkState(state, info); } catch (RemoteException e) { Log.e(TAG, "updateNetworkState failed", e); } diff --git a/location/java/com/android/internal/location/MockProvider.java b/location/java/com/android/internal/location/MockProvider.java index e2e056243e0b4..2614f827a15d6 100644 --- a/location/java/com/android/internal/location/MockProvider.java +++ b/location/java/com/android/internal/location/MockProvider.java @@ -20,6 +20,7 @@ import android.location.ILocationManager; import android.location.ILocationProvider; import android.location.Location; import android.location.LocationProvider; +import android.net.NetworkInfo; import android.os.Bundle; import android.os.RemoteException; import android.util.Log; @@ -169,7 +170,7 @@ public class MockProvider extends ILocationProvider.Stub { public void setMinTime(long minTime) { } - public void updateNetworkState(int state) { + public void updateNetworkState(int state, NetworkInfo info) { } public void updateLocation(Location location) { diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp index 3204d9af90d89..1e4c13668756e 100644 --- a/opengl/libs/GLES_CM/gl.cpp +++ b/opengl/libs/GLES_CM/gl.cpp @@ -31,6 +31,9 @@ using namespace android; +// set this to 1 for crude GL debugging +#define CHECK_FOR_GL_ERRORS 0 + // ---------------------------------------------------------------------------- // extensions for the framework // ---------------------------------------------------------------------------- @@ -71,7 +74,7 @@ void glVertexPointerBounds(GLint size, GLenum type, #undef CALL_GL_API #undef CALL_GL_API_RETURN -#if USE_FAST_TLS_KEY +#if USE_FAST_TLS_KEY && !CHECK_FOR_GL_ERRORS #define API_ENTRY(_api) __attribute__((naked)) _api @@ -95,12 +98,27 @@ void glVertexPointerBounds(GLint size, GLenum type, #else + #if CHECK_FOR_GL_ERRORS + + #define CHECK_GL_ERRORS(_api) \ + do { GLint err = glGetError(); \ + LOGE_IF(err != GL_NO_ERROR, "%s failed (0x%04X)", #_api, err); \ + } while(false); + + #else + + #define CHECK_GL_ERRORS(_api) do { } while(false); + + #endif + + #define API_ENTRY(_api) _api #define CALL_GL_API(_api, ...) \ gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \ - _c->_api(__VA_ARGS__) - + _c->_api(__VA_ARGS__); \ + CHECK_GL_ERRORS(_api) + #define CALL_GL_API_RETURN(_api, ...) \ gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \ return _c->_api(__VA_ARGS__) diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java index c8fa4c39ad03f..d1b3bd06c5137 100644 --- a/services/java/com/android/server/LocationManagerService.java +++ b/services/java/com/android/server/LocationManagerService.java @@ -48,6 +48,7 @@ import android.location.Location; import android.location.LocationManager; import android.location.LocationProvider; import android.net.ConnectivityManager; +import android.net.NetworkInfo; import android.net.Uri; import android.os.Binder; import android.os.Bundle; @@ -529,7 +530,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run } // notify provider of current network state - proxy.updateNetworkState(mNetworkState); + proxy.updateNetworkState(mNetworkState, null); } } @@ -1600,13 +1601,15 @@ public class LocationManagerService extends ILocationManager.Stub implements Run } else { mNetworkState = LocationProvider.TEMPORARILY_UNAVAILABLE; } + NetworkInfo info = + (NetworkInfo)intent.getExtra(ConnectivityManager.EXTRA_NETWORK_INFO); // Notify location providers of current network state synchronized (mLock) { for (int i = mProviders.size() - 1; i >= 0; i--) { LocationProviderProxy provider = mProviders.get(i); if (provider.requiresNetwork()) { - provider.updateNetworkState(mNetworkState); + provider.updateNetworkState(mNetworkState, info); } } } diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java index aacae1802bcd5..101b075e22560 100644 --- a/services/java/com/android/server/TelephonyRegistry.java +++ b/services/java/com/android/server/TelephonyRegistry.java @@ -94,6 +94,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { private Bundle mCellLocation = new Bundle(); + private int mDataConnectionNetworkType; + static final int PHONE_STATE_PERMISSION_MASK = PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR | PhoneStateListener.LISTEN_CALL_STATE | @@ -187,7 +189,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } if ((events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) { try { - r.callback.onDataConnectionStateChanged(mDataConnectionState); + r.callback.onDataConnectionStateChanged(mDataConnectionState, + mDataConnectionNetworkType); } catch (RemoteException ex) { remove(r.binder); } @@ -345,7 +348,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } public void notifyDataConnection(int state, boolean isDataConnectivityPossible, - String reason, String apn, String[] apnTypes, String interfaceName) { + String reason, String apn, String[] apnTypes, String interfaceName, int networkType) { if (!checkNotifyPermission("notifyDataConnection()" )) { return; } @@ -356,11 +359,12 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { mDataConnectionApn = apn; mDataConnectionApnTypes = apnTypes; mDataConnectionInterfaceName = interfaceName; + mDataConnectionNetworkType = networkType; for (int i = mRecords.size() - 1; i >= 0; i--) { Record r = mRecords.get(i); if ((r.events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) { try { - r.callback.onDataConnectionStateChanged(state); + r.callback.onDataConnectionStateChanged(state, networkType); } catch (RemoteException ex) { remove(r.binder); } diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index c611795f79a27..e1e8beae7dd26 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -1436,6 +1436,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen mSimpleProcessManagement = true; } + Log.i(TAG, "Memory class: " + ActivityManager.staticGetMemoryClass()); + MY_PID = Process.myPid(); File dataDir = Environment.getDataDirectory(); @@ -4556,7 +4558,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen long now = SystemClock.uptimeMillis(); for (i=0; i= 4) iconLevel = 2; else iconLevel = 1; + // Though mPhone is a Manager, this call is not an IPC if (mPhone.isNetworkRoaming()) { iconList = sSignalImages_r; } else { @@ -956,8 +957,7 @@ public class StatusBarPolicy { return (levelEvdoDbm < levelEvdoSnr) ? levelEvdoDbm : levelEvdoSnr; } - private final void updateDataNetType() { - int net = mPhone.getNetworkType(); + private final void updateDataNetType(int net) { switch (net) { case TelephonyManager.NETWORK_TYPE_EDGE: @@ -1211,7 +1211,7 @@ public class StatusBarPolicy { } } - private final void updateCdmaRoamingIcon() { + private final void updateCdmaRoamingIcon(ServiceState state) { if (!hasService()) { mService.setIconVisibility(mCdmaRoamingIndicatorIcon, false); return; @@ -1223,8 +1223,8 @@ public class StatusBarPolicy { } int[] iconList = sRoamingIndicatorImages_cdma; - int iconIndex = mPhone.getCdmaEriIconIndex(); - int iconMode = mPhone.getCdmaEriIconMode(); + int iconIndex = state.getCdmaEriIconIndex(); + int iconMode = state.getCdmaEriIconMode(); if (iconIndex == -1) { Log.e(TAG, "getCdmaEriIconIndex returned null, skipping ERI icon update"); diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java index 73e7baa593a64..ea6593e2ecc86 100644 --- a/telephony/java/android/telephony/PhoneStateListener.java +++ b/telephony/java/android/telephony/PhoneStateListener.java @@ -205,6 +205,13 @@ public class PhoneStateListener { // default implementation empty } + /** + * @hide + * same as above, but with the network type. Both called. + */ + public void onDataConnectionStateChanged(int state, int networkType) { + } + /** * Callback invoked when data activity state changes. * @@ -264,8 +271,9 @@ public class PhoneStateListener { Message.obtain(mHandler, LISTEN_CALL_STATE, state, 0, incomingNumber).sendToTarget(); } - public void onDataConnectionStateChanged(int state) { - Message.obtain(mHandler, LISTEN_DATA_CONNECTION_STATE, state, 0, null).sendToTarget(); + public void onDataConnectionStateChanged(int state, int networkType) { + Message.obtain(mHandler, LISTEN_DATA_CONNECTION_STATE, state, networkType, null). + sendToTarget(); } public void onDataActivity(int direction) { @@ -299,6 +307,7 @@ public class PhoneStateListener { PhoneStateListener.this.onCallStateChanged(msg.arg1, (String)msg.obj); break; case LISTEN_DATA_CONNECTION_STATE: + PhoneStateListener.this.onDataConnectionStateChanged(msg.arg1, msg.arg2); PhoneStateListener.this.onDataConnectionStateChanged(msg.arg1); break; case LISTEN_DATA_ACTIVITY: diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 06b5c2619689a..48a40fa6a6ae6 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -120,6 +120,8 @@ public class ServiceState implements Parcelable { private int mSystemId; private int mCdmaRoamingIndicator; private int mCdmaDefaultRoamingIndicator; + private int mCdmaEriIconIndex; + private int mCdmaEriIconMode; /** * Create a new ServiceState from a intent notifier Bundle @@ -166,6 +168,8 @@ public class ServiceState implements Parcelable { mSystemId = s.mSystemId; mCdmaRoamingIndicator = s.mCdmaRoamingIndicator; mCdmaDefaultRoamingIndicator = s.mCdmaDefaultRoamingIndicator; + mCdmaEriIconIndex = s.mCdmaEriIconIndex; + mCdmaEriIconMode = s.mCdmaEriIconMode; } /** @@ -184,6 +188,8 @@ public class ServiceState implements Parcelable { mSystemId = in.readInt(); mCdmaRoamingIndicator = in.readInt(); mCdmaDefaultRoamingIndicator = in.readInt(); + mCdmaEriIconIndex = in.readInt(); + mCdmaEriIconMode = in.readInt(); } public void writeToParcel(Parcel out, int flags) { @@ -199,6 +205,8 @@ public class ServiceState implements Parcelable { out.writeInt(mSystemId); out.writeInt(mCdmaRoamingIndicator); out.writeInt(mCdmaDefaultRoamingIndicator); + out.writeInt(mCdmaEriIconIndex); + out.writeInt(mCdmaEriIconMode); } public int describeContents() { @@ -253,6 +261,20 @@ public class ServiceState implements Parcelable { return this.mCdmaDefaultRoamingIndicator; } + /** + * @hide + */ + public int getCdmaEriIconIndex() { + return this.mCdmaEriIconIndex; + } + + /** + * @hide + */ + public int getCdmaEriIconMode() { + return this.mCdmaEriIconMode; + } + /** * Get current registered operator name in long alphanumeric format * @@ -412,8 +434,11 @@ public class ServiceState implements Parcelable { mSystemId = -1; mCdmaRoamingIndicator = -1; mCdmaDefaultRoamingIndicator = -1; + mCdmaEriIconIndex = -1; + mCdmaEriIconMode = -1; } + // TODO - can't this be combined with the above func.. public void setStateOff() { mState = STATE_POWER_OFF; mRoaming = false; @@ -427,6 +452,8 @@ public class ServiceState implements Parcelable { mSystemId = -1; mCdmaRoamingIndicator = -1; mCdmaDefaultRoamingIndicator = -1; + mCdmaEriIconIndex = -1; + mCdmaEriIconMode = -1; } public void setState(int state) { @@ -451,6 +478,20 @@ public class ServiceState implements Parcelable { this.mCdmaDefaultRoamingIndicator = roaming; } + /** + * @hide + */ + public void setCdmaEriIconIndex(int index) { + this.mCdmaEriIconIndex = index; + } + + /** + * @hide + */ + public void setCdmaEriIconMode(int mode) { + this.mCdmaEriIconMode = mode; + } + public void setOperatorName(String longName, String shortName, String numeric) { mOperatorAlphaLong = longName; mOperatorAlphaShort = shortName; diff --git a/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java b/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java index 00d7c72e14253..4da4b6abe73d5 100644 --- a/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java +++ b/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java @@ -93,13 +93,16 @@ public class DefaultPhoneNotifier implements PhoneNotifier { } public void notifyDataConnection(Phone sender, String reason) { + TelephonyManager telephony = TelephonyManager.getDefault(); try { mRegistry.notifyDataConnection( convertDataState(sender.getDataConnectionState()), sender.isDataConnectivityPossible(), reason, sender.getActiveApn(), sender.getActiveApnTypes(), - sender.getInterfaceName(null)); + sender.getInterfaceName(null), + ((telephony!=null) ? telephony.getNetworkType() : + TelephonyManager.NETWORK_TYPE_UNKNOWN)); } catch (RemoteException ex) { // system process is dead } diff --git a/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl b/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl index 0202ec81edf3f..856d6638d71b6 100644 --- a/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl +++ b/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl @@ -29,7 +29,7 @@ oneway interface IPhoneStateListener { // we use bundle here instead of CellLocation so it can get the right subclass void onCellLocationChanged(in Bundle location); void onCallStateChanged(int state, String incomingNumber); - void onDataConnectionStateChanged(int state); + void onDataConnectionStateChanged(int state, int networkType); void onDataActivity(int direction); void onSignalStrengthsChanged(in SignalStrength signalStrength); } diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl index 6b42e6b3c8601..5bf8e58265932 100644 --- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl @@ -32,7 +32,7 @@ interface ITelephonyRegistry { void notifyCallForwardingChanged(boolean cfi); void notifyDataActivity(int state); void notifyDataConnection(int state, boolean isDataConnectivityPossible, - String reason, String apn, in String[] apnTypes, String interfaceName); + String reason, String apn, in String[] apnTypes, String interfaceName, int networkType); void notifyDataConnectionFailed(String reason); void notifyCellLocation(in Bundle cellLocation); } diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java index 6dcfcd93beb5c..22fbe8bf1a303 100755 --- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java +++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java @@ -257,6 +257,12 @@ public class CDMAPhone extends PhoneBase { } public ServiceState getServiceState() { + int roamInd = mSST.ss.getCdmaRoamingIndicator(); + int defRoamInd = mSST.ss.getCdmaDefaultRoamingIndicator(); + + mSST.ss.setCdmaEriIconIndex(mEriManager.getCdmaEriIconIndex(roamInd, defRoamInd)); + mSST.ss.setCdmaEriIconMode(mEriManager.getCdmaEriIconMode(roamInd, defRoamInd)); + return mSST.ss; } @@ -798,6 +804,10 @@ public class CDMAPhone extends PhoneBase { } void notifyServiceStateChanged(ServiceState ss) { + // TODO this seems really inefficient. Can't we calc this when the fundamentals change and store in the + // service state? + ss.setCdmaEriIconIndex(this.getCdmaEriIconIndex()); + ss.setCdmaEriIconMode(this.getCdmaEriIconMode()); super.notifyServiceStateChangedP(ss); } diff --git a/test-runner/android/test/TestLocationProvider.java b/test-runner/android/test/TestLocationProvider.java index 2ea020ebc7ff0..dc07585cede83 100644 --- a/test-runner/android/test/TestLocationProvider.java +++ b/test-runner/android/test/TestLocationProvider.java @@ -22,6 +22,7 @@ import android.location.ILocationManager; import android.location.ILocationProvider; import android.location.Location; import android.location.LocationProvider; +import android.net.NetworkInfo; import android.os.Bundle; import android.os.RemoteException; import android.os.SystemClock; @@ -156,7 +157,7 @@ public class TestLocationProvider extends ILocationProvider.Stub { public void setMinTime(long minTime) { } - public void updateNetworkState(int state) { + public void updateNetworkState(int state, NetworkInfo info) { } public void updateLocation(Location location) {