Merge branch 'eclair' into eclair-release

This commit is contained in:
The Android Open Source Project
2009-10-09 15:01:28 -07:00
32 changed files with 314 additions and 82 deletions

View File

@@ -17299,6 +17299,17 @@
visibility="public"
>
</method>
<method name="getMemoryClass"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getMemoryInfo"
return="void"
abstract="false"

View File

@@ -56,6 +56,8 @@ static void dumpstate(int full) {
EXEC_XBIN("procrank");
PRINT("------ VIRTUAL MEMORY STATS ------");
DUMP("/proc/vmstat");
PRINT("------ VMALLOC INFO ------");
DUMP("/proc/vmallocinfo");
PRINT("------ SLAB INFO ------");
DUMP("/proc/slabinfo");
PRINT("------ ZONEINFO ------");

View File

@@ -27,6 +27,7 @@ import android.os.RemoteException;
import android.os.Handler;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemProperties;
import android.text.TextUtils;
import java.util.List;
@@ -46,6 +47,26 @@ public class ActivityManager {
mHandler = handler;
}
/**
* Return the approximate per-application memory class of the current
* device. This gives you an idea of how hard a memory limit you should
* impose on your application to let the overall system work best. The
* returned value is in megabytes; the baseline Android memory class is
* 16 (which happens to be the Java heap limit of those devices); some
* device with more memory may return 24 or even higher numbers.
*/
public int getMemoryClass() {
return staticGetMemoryClass();
}
/** @hide */
static public int staticGetMemoryClass() {
// Really brain dead right now -- just take this from the configured
// vm heap size, and assume it is in megabytes and thus ends with "m".
String vmHeapSize = SystemProperties.get("dalvik.vm.heapsize", "16m");
return Integer.parseInt(vmHeapSize.substring(0, vmHeapSize.length()-1));
}
/**
* Information you can retrieve about tasks that the user has most recently
* started or visited.

View File

@@ -46,7 +46,7 @@ import java.util.UUID;
*/
public final class BluetoothAdapter {
private static final String TAG = "BluetoothAdapter";
private static final boolean DBG = true; //STOPSHIP: Remove excess logging
private static final boolean DBG = false;
/**
* Sentinel error value for this class. Guaranteed to not equal any other
@@ -569,6 +569,7 @@ public final class BluetoothAdapter {
* <p>Applications can also register for {@link #ACTION_DISCOVERY_STARTED}
* or {@link #ACTION_DISCOVERY_FINISHED} to be notified when discovery
* starts or completes.
* <p>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.
* <p>Requires {@link android.Manifest.permission#BLUETOOTH}.
*
* @return unmodifiable set of {@link BluetoothDevice}, or null on error
*/

View File

@@ -513,6 +513,7 @@ public final class BluetoothDevice implements Parcelable {
/**
* Get trust state of a remote device.
* <p>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.
* <p>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.
* <p>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.
* <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN}
*
* @return a SCO BluetoothSocket
* @throws IOException on error, for example Bluetooth not available, or
* insufficient permissions.

View File

@@ -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);

View File

@@ -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

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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

View File

@@ -19,5 +19,5 @@
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@anim/accelerate_interpolator">
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="@android:integer/config_mediumAnimTime" />
android:duration="@android:integer/config_longAnimTime" />
</set>

View File

@@ -19,5 +19,5 @@
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@anim/accelerate_interpolator">
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
android:duration="@android:integer/config_mediumAnimTime" />
android:duration="@android:integer/config_longAnimTime" />
</set>

View File

@@ -35,10 +35,10 @@
<integer name="config_shortAnimTime">150</integer>
<!-- The duration (in milliseconds) of a medium-length animation. -->
<integer name="config_mediumAnimTime">200</integer>
<integer name="config_mediumAnimTime">300</integer>
<!-- The duration (in milliseconds) of a long animation. -->
<integer name="config_longAnimTime">350</integer>
<integer name="config_longAnimTime">400</integer>
<!-- XXXXX NOTE THE FOLLOWING RESOURCES USE THE WRONG NAMING CONVENTION.
Please don't copy them, copy anything else. -->

View File

@@ -16,7 +16,7 @@
#include <math.h>
#define LOG_NDEBUG 0
//#define LOG_NDEBUG 0
#define LOG_TAG "A2dpAudioInterface"
#include <utils/Log.h>
#include <utils/String8.h>
@@ -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);

View File

@@ -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;
};

View File

@@ -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);

View File

@@ -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();

View File

@@ -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);
}

View File

@@ -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) {

View File

@@ -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__)

View File

@@ -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);
}
}
}

View File

@@ -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);
}

View File

@@ -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<count; i++) {
ProcessRecord rec = mLRUProcesses.get(i);
if (rec.thread != null &&
if (rec != app && rec.thread != null &&
(rec.lastLowMemory+GC_MIN_INTERVAL) <= now) {
// The low memory report is overriding any current
// state for a GC request. Make sure to do
@@ -9852,6 +9854,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
mLRUProcesses.remove(index);
}
mProcessesToGc.remove(app);
// Dismiss any open dialogs.
if (app.crashDialog != null) {
app.crashDialog.dismiss();
@@ -10519,7 +10523,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
//Log.i(TAG, "Bring up service:");
//r.dump(" ");
if (r.app != null) {
if (r.app != null && r.app.thread != null) {
sendServiceArgsLocked(r, false);
return true;
}
@@ -10550,20 +10554,22 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
// restart the application.
}
// Not running -- get it started, and enqueue this service record
// to be executed when the app comes up.
if (startProcessLocked(appName, r.appInfo, true, intentFlags,
"service", r.name, false) == null) {
Log.w(TAG, "Unable to launch app "
+ r.appInfo.packageName + "/"
+ r.appInfo.uid + " for service "
+ r.intent.getIntent() + ": process is bad");
bringDownServiceLocked(r, true);
return false;
}
if (!mPendingServices.contains(r)) {
// Not running -- get it started, and enqueue this service record
// to be executed when the app comes up.
if (startProcessLocked(appName, r.appInfo, true, intentFlags,
"service", r.name, false) == null) {
Log.w(TAG, "Unable to launch app "
+ r.appInfo.packageName + "/"
+ r.appInfo.uid + " for service "
+ r.intent.getIntent() + ": process is bad");
bringDownServiceLocked(r, true);
return false;
}
mPendingServices.add(r);
}
return true;
}

View File

@@ -782,7 +782,7 @@ public class StatusBarPolicy {
public void onServiceStateChanged(ServiceState state) {
mServiceState = state;
updateSignalStrength();
updateCdmaRoamingIcon();
updateCdmaRoamingIcon(state);
updateDataIcon();
}
@@ -796,9 +796,9 @@ public class StatusBarPolicy {
}
@Override
public void onDataConnectionStateChanged(int state) {
public void onDataConnectionStateChanged(int state, int networkType) {
mDataState = state;
updateDataNetType();
updateDataNetType(networkType);
updateDataIcon();
}
@@ -835,7 +835,7 @@ public class StatusBarPolicy {
}
private boolean isCdma() {
return ((mPhone != null) && (mPhone.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA));
return (mSignalStrength != null) && !mSignalStrength.isGsm();
}
private boolean isEvdo() {
@@ -889,6 +889,7 @@ public class StatusBarPolicy {
else if (asu >= 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");

View File

@@ -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:

View File

@@ -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;

View File

@@ -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
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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) {