Merge "Adjust SQLiteDatabase/Program buffer sizes"
diff --git a/api/current.xml b/api/current.xml
index c3a7b26..444b002 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -78725,6 +78725,17 @@
visibility="public"
>
</field>
+<field name="PASSIVE_PROVIDER"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""passive""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
</class>
<class name="LocationProvider"
extends="java.lang.Object"
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index 9ff2e25..4ddb819 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -447,17 +447,6 @@
}
/**
- * Returns whether or not sync is enabled. Sync can be enabled by
- * setting the system property "ro.config.sync" to the value "yes".
- * This is normally done at boot time on builds that support sync.
- * @return true if sync is enabled
- */
- private boolean isSyncEnabled() {
- // Require the precise value "yes" to discourage accidental activation.
- return "yes".equals(SystemProperties.get("ro.config.sync"));
- }
-
- /**
* Initiate a sync. This can start a sync for all providers
* (pass null to url, set onlyTicklable to false), only those
* providers that are marked as ticklable (pass null to url,
@@ -488,13 +477,6 @@
Bundle extras, long delay, boolean onlyThoseWithUnkownSyncableState) {
boolean isLoggable = Log.isLoggable(TAG, Log.VERBOSE);
- if (!isSyncEnabled()) {
- if (isLoggable) {
- Log.v(TAG, "not syncing because sync is disabled");
- }
- return;
- }
-
final boolean backgroundDataUsageAllowed = !mBootCompleted ||
getConnectivityManager().getBackgroundDataSetting();
@@ -922,9 +904,7 @@
protected void dump(FileDescriptor fd, PrintWriter pw) {
StringBuilder sb = new StringBuilder();
dumpSyncState(pw, sb);
- if (isSyncEnabled()) {
- dumpSyncHistory(pw, sb);
- }
+ dumpSyncHistory(pw, sb);
pw.println();
pw.println("SyncAdapters:");
@@ -940,7 +920,6 @@
}
protected void dumpSyncState(PrintWriter pw, StringBuilder sb) {
- pw.print("sync enabled: "); pw.println(isSyncEnabled());
pw.print("data connected: "); pw.println(mDataConnectionIsConnected);
pw.print("memory low: "); pw.println(mStorageIsLow);
@@ -1456,11 +1435,6 @@
boolean backgroundDataUsageAllowed) {
Account[] accounts = mAccounts;
- // Sync is disabled, drop this operation.
- if (!isSyncEnabled()) {
- return false;
- }
-
// skip the sync if the account of this operation no longer exists
if (!ArrayUtils.contains(accounts, account)) {
return false;
diff --git a/core/java/android/webkit/MimeTypeMap.java b/core/java/android/webkit/MimeTypeMap.java
index a9d6ff6..3ed9851 100644
--- a/core/java/android/webkit/MimeTypeMap.java
+++ b/core/java/android/webkit/MimeTypeMap.java
@@ -368,6 +368,7 @@
sMimeTypeMap.loadEntry("application/x-xcf", "xcf");
sMimeTypeMap.loadEntry("application/x-xfig", "fig");
sMimeTypeMap.loadEntry("application/xhtml+xml", "xhtml");
+ sMimeTypeMap.loadEntry("audio/3gpp", "3gpp");
sMimeTypeMap.loadEntry("audio/basic", "snd");
sMimeTypeMap.loadEntry("audio/midi", "mid");
sMimeTypeMap.loadEntry("audio/midi", "midi");
diff --git a/core/jni/android_util_FileObserver.cpp b/core/jni/android_util_FileObserver.cpp
index 13a1645..65e7130 100644
--- a/core/jni/android_util_FileObserver.cpp
+++ b/core/jni/android_util_FileObserver.cpp
@@ -71,28 +71,32 @@
return;
}
- while (num_bytes >= (int)sizeof(*event))
- {
- int event_size;
- event = (struct inotify_event *)(event_buf + event_pos);
-
+ while (num_bytes >= (int)sizeof(*event))
+ {
+ int event_size;
+ event = (struct inotify_event *)(event_buf + event_pos);
+
jstring path = NULL;
if (event->len > 0)
{
path = env->NewStringUTF(event->name);
}
-
- env->CallVoidMethod(object, method_onEvent, event->wd, event->mask, path);
+
+ env->CallVoidMethod(object, method_onEvent, event->wd, event->mask, path);
+ if (env->ExceptionCheck()) {
+ env->ExceptionDescribe();
+ env->ExceptionClear();
+ }
if (path != NULL)
{
env->DeleteLocalRef(path);
}
-
- event_size = sizeof(*event) + event->len;
- num_bytes -= event_size;
- event_pos += event_size;
- }
+
+ event_size = sizeof(*event) + event->len;
+ num_bytes -= event_size;
+ event_pos += event_size;
+ }
}
#endif // HAVE_INOTIFY
diff --git a/graphics/java/android/graphics/AvoidXfermode.java b/graphics/java/android/graphics/AvoidXfermode.java
index 2ed042b..7e2722d 100644
--- a/graphics/java/android/graphics/AvoidXfermode.java
+++ b/graphics/java/android/graphics/AvoidXfermode.java
@@ -38,15 +38,15 @@
*
* There are two modes, and each mode interprets a tolerance value.
*
- * AVOID: In this mode, drawing is allowed only on destination pixels that
+ * Avoid: In this mode, drawing is allowed only on destination pixels that
* are different from the op-color.
- * Tolerance near 0: avoid anything close to the op-color
- * Tolerance near 255: avoid only colors very close to the op-color
- *
- * TARGET: In this mode, drawing only occurs on destination pixels that
+ * Tolerance near 0: avoid any colors even remotely similar to the op-color
+ * Tolerance near 255: avoid only colors nearly identical to the op-color
+
+ * Target: In this mode, drawing only occurs on destination pixels that
* are similar to the op-color
- * Tolerance near 0: draw on colors that are very close to op-color
- * Tolerance near 255: draw on colors that to the op-color
+ * Tolerance near 0: draw only on colors that are nearly identical to the op-color
+ * Tolerance near 255: draw on any colors even remotely similar to the op-color
*/
public AvoidXfermode(int opColor, int tolerance, Mode mode) {
if (tolerance < 0 || tolerance > 255) {
diff --git a/include/ui/Region.h b/include/ui/Region.h
index 2bcad5b..925fd06 100644
--- a/include/ui/Region.h
+++ b/include/ui/Region.h
@@ -21,7 +21,6 @@
#include <sys/types.h>
#include <utils/Vector.h>
-#include <binder/Parcel.h>
#include <ui/Rect.h>
@@ -39,7 +38,6 @@
Region();
Region(const Region& rhs);
explicit Region(const Rect& rhs);
- explicit Region(const Parcel& parcel);
explicit Region(const void* buffer);
~Region();
@@ -118,10 +116,6 @@
// be sorted in Y and X and must not make the region invalid.
void addRectUnchecked(int l, int t, int r, int b);
- // flatten/unflatten a region to/from a Parcel
- status_t write(Parcel& parcel) const;
- status_t read(const Parcel& parcel);
-
// flatten/unflatten a region to/from a raw buffer
ssize_t write(void* buffer, size_t size) const;
static ssize_t writeEmpty(void* buffer, size_t size);
diff --git a/libs/surfaceflinger_client/LayerState.cpp b/libs/surfaceflinger_client/LayerState.cpp
index 114a9e9..01c4c7e 100644
--- a/libs/surfaceflinger_client/LayerState.cpp
+++ b/libs/surfaceflinger_client/LayerState.cpp
@@ -22,17 +22,37 @@
status_t layer_state_t::write(Parcel& output) const
{
+ status_t err;
+
+ size_t len = transparentRegion.write(NULL, 0);
+ err = output.writeInt32(len);
+ if (err < NO_ERROR) return err;
+
+ void* buf = output.writeInplace(len);
+ if (buf == NULL) return NO_MEMORY;
+
+ err = transparentRegion.write(buf, len);
+ if (err < NO_ERROR) return err;
+
+ // NOTE: regions are at the end of the structure
size_t size = sizeof(layer_state_t);
- transparentRegion.write(output);
size -= sizeof(transparentRegion);
- output.write(this, size);
- return NO_ERROR;
+ err = output.write(this, size);
+ return err;
}
status_t layer_state_t::read(const Parcel& input)
{
+ status_t err;
+ size_t len = input.readInt32();
+ void const* buf = input.readInplace(len);
+ if (buf == NULL) return NO_MEMORY;
+
+ err = transparentRegion.read(buf);
+ if (err < NO_ERROR) return err;
+
+ // NOTE: regions are at the end of the structure
size_t size = sizeof(layer_state_t);
- transparentRegion.read(input);
size -= sizeof(transparentRegion);
input.read(this, size);
return NO_ERROR;
diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp
index d21ed57..12db908 100644
--- a/libs/ui/Region.cpp
+++ b/libs/ui/Region.cpp
@@ -63,16 +63,10 @@
{
}
-Region::Region(const Parcel& parcel)
-{
- status_t err = read(parcel);
- LOGE_IF(err<0, "error %s reading Region from parcel", strerror(err));
-}
-
Region::Region(const void* buffer)
{
status_t err = read(buffer);
- LOGE_IF(err<0, "error %s reading Region from parcel", strerror(err));
+ LOGE_IF(err<0, "error %s reading Region from buffer", strerror(err));
}
Region::~Region()
@@ -532,37 +526,6 @@
// ----------------------------------------------------------------------------
-status_t Region::write(Parcel& parcel) const
-{
-#if VALIDATE_REGIONS
- validate(*this, "write(Parcel)");
-#endif
- status_t err;
- const size_t count = mStorage.size();
- const size_t sizeNeeded = sizeof(int32_t) + (1+count)*sizeof(Rect);
- void* buffer = parcel.writeInplace(sizeNeeded);
- if (!buffer) return NO_MEMORY;
- ssize_t written = Region::write(buffer, sizeNeeded);
- if (written < 0) return status_t(written);
- return NO_ERROR;
-}
-
-status_t Region::read(const Parcel& parcel)
-{
- void const* buffer = parcel.readInplace(sizeof(int32_t));
- if (!buffer) return NO_MEMORY;
- const size_t count = *static_cast<int32_t const *>(buffer);
- void const* dummy = parcel.readInplace((1+count)*sizeof(Rect));
- if (!dummy) return NO_MEMORY;
- const size_t sizeNeeded = sizeof(int32_t) + (1+count)*sizeof(Rect);
- const ssize_t read = Region::read(buffer);
- if (read < 0) return status_t(read);
-#if VALIDATE_REGIONS
- validate(*this, "read(Parcel)");
-#endif
- return NO_ERROR;
-}
-
ssize_t Region::write(void* buffer, size_t size) const
{
#if VALIDATE_REGIONS
@@ -570,12 +533,14 @@
#endif
const size_t count = mStorage.size();
const size_t sizeNeeded = sizeof(int32_t) + (1+count)*sizeof(Rect);
- if (sizeNeeded > size) return NO_MEMORY;
- int32_t* const p = static_cast<int32_t*>(buffer);
- *p = count;
- memcpy(p+1, &mBounds, sizeof(Rect));
- if (count) {
- memcpy(p+5, mStorage.array(), count*sizeof(Rect));
+ if (buffer != NULL) {
+ if (sizeNeeded > size) return NO_MEMORY;
+ int32_t* const p = static_cast<int32_t*>(buffer);
+ *p = count;
+ memcpy(p+1, &mBounds, sizeof(Rect));
+ if (count) {
+ memcpy(p+5, mStorage.array(), count*sizeof(Rect));
+ }
}
return ssize_t(sizeNeeded);
}
diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl
index 8c24ee1..2c0399e 100644
--- a/location/java/android/location/ILocationManager.aidl
+++ b/location/java/android/location/ILocationManager.aidl
@@ -59,8 +59,10 @@
Location getLastKnownLocation(String provider);
- /* used by location providers to tell the location manager when it has a new location */
- void reportLocation(in Location location);
+ // Used by location providers to tell the location manager when it has a new location.
+ // Passive is true if the location is coming from the passive provider, in which case
+ // it need not be shared with other providers.
+ void reportLocation(in Location location, boolean passive);
String getFromLocation(double latitude, double longitude, int maxResults,
in GeocoderParams params, out List<Address> addrs);
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 9027fc2..da760a1 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -81,6 +81,19 @@
public static final String GPS_PROVIDER = "gps";
/**
+ * A special location provider for receiving locations without actually initiating
+ * a location fix. This provider can be used to passively receive location updates
+ * when other applications or services request them without actually requesting
+ * the locations yourself. This provider will return locations generated by other
+ * providers. You can query the {@link Location#getProvider()} method to determine
+ * the origin of the location update.
+ *
+ * Requires the permission android.permission.ACCESS_FINE_LOCATION, although if the GPS
+ * is not enabled this provider might only return coarse fixes.
+ */
+ public static final String PASSIVE_PROVIDER = "passive";
+
+ /**
* Key used for the Bundle extra holding a boolean indicating whether
* a proximity alert is entering (true) or exiting (false)..
*/
diff --git a/location/java/android/location/LocationProvider.java b/location/java/android/location/LocationProvider.java
index 3faba58..bb3e2a5 100644
--- a/location/java/android/location/LocationProvider.java
+++ b/location/java/android/location/LocationProvider.java
@@ -71,6 +71,10 @@
* false otherwise.
*/
public boolean meetsCriteria(Criteria criteria) {
+ // We do not want to match the special passive provider based on criteria.
+ if (LocationManager.PASSIVE_PROVIDER.equals(mName)) {
+ return false;
+ }
if ((criteria.getAccuracy() != Criteria.NO_REQUIREMENT) &&
(criteria.getAccuracy() < getAccuracy())) {
return false;
diff --git a/location/java/android/location/provider/LocationProvider.java b/location/java/android/location/provider/LocationProvider.java
index 0d028c0..4163def 100644
--- a/location/java/android/location/provider/LocationProvider.java
+++ b/location/java/android/location/provider/LocationProvider.java
@@ -156,7 +156,7 @@
*/
public void reportLocation(Location location) {
try {
- mLocationManager.reportLocation(location);
+ mLocationManager.reportLocation(location, false);
} catch (RemoteException e) {
Log.e(TAG, "RemoteException in reportLocation: ", e);
}
diff --git a/location/java/com/android/internal/location/GpsLocationProvider.java b/location/java/com/android/internal/location/GpsLocationProvider.java
index dce3b27..8e84106 100755
--- a/location/java/com/android/internal/location/GpsLocationProvider.java
+++ b/location/java/com/android/internal/location/GpsLocationProvider.java
@@ -863,7 +863,7 @@
}
try {
- mLocationManager.reportLocation(mLocation);
+ mLocationManager.reportLocation(mLocation, false);
} catch (RemoteException e) {
Log.e(TAG, "RemoteException calling reportLocation");
}
diff --git a/location/java/com/android/internal/location/MockProvider.java b/location/java/com/android/internal/location/MockProvider.java
index 2f6fdee..bc1893e 100644
--- a/location/java/com/android/internal/location/MockProvider.java
+++ b/location/java/com/android/internal/location/MockProvider.java
@@ -143,7 +143,7 @@
mLocation.set(l);
mHasLocation = true;
try {
- mLocationManager.reportLocation(mLocation);
+ mLocationManager.reportLocation(mLocation, false);
} catch (RemoteException e) {
Log.e(TAG, "RemoteException calling reportLocation");
}
diff --git a/location/java/com/android/internal/location/PassiveProvider.java b/location/java/com/android/internal/location/PassiveProvider.java
new file mode 100644
index 0000000..7eb711d
--- /dev/null
+++ b/location/java/com/android/internal/location/PassiveProvider.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.location;
+
+import android.location.ILocationManager;
+import android.location.Location;
+import android.location.LocationManager;
+import android.location.LocationProvider;
+import android.location.LocationProviderInterface;
+import android.net.NetworkInfo;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.util.Log;
+
+/**
+ * A passive location provider reports locations received from other providers
+ * for clients that want to listen passively without actually triggering
+ * location updates.
+ *
+ * {@hide}
+ */
+public class PassiveProvider implements LocationProviderInterface {
+
+ private static final String TAG = "PassiveProvider";
+
+ private final ILocationManager mLocationManager;
+ private boolean mTracking;
+
+ public PassiveProvider(ILocationManager locationManager) {
+ mLocationManager = locationManager;
+ }
+
+ public String getName() {
+ return LocationManager.PASSIVE_PROVIDER;
+ }
+
+ public boolean requiresNetwork() {
+ return false;
+ }
+
+ public boolean requiresSatellite() {
+ return false;
+ }
+
+ public boolean requiresCell() {
+ return false;
+ }
+
+ public boolean hasMonetaryCost() {
+ return false;
+ }
+
+ public boolean supportsAltitude() {
+ return false;
+ }
+
+ public boolean supportsSpeed() {
+ return false;
+ }
+
+ public boolean supportsBearing() {
+ return false;
+ }
+
+ public int getPowerRequirement() {
+ return -1;
+ }
+
+ public int getAccuracy() {
+ return -1;
+ }
+
+ public boolean isEnabled() {
+ return true;
+ }
+
+ public void enable() {
+ }
+
+ public void disable() {
+ }
+
+ public int getStatus(Bundle extras) {
+ if (mTracking) {
+ return LocationProvider.AVAILABLE;
+ } else {
+ return LocationProvider.TEMPORARILY_UNAVAILABLE;
+ }
+ }
+
+ public long getStatusUpdateTime() {
+ return -1;
+ }
+
+ public void enableLocationTracking(boolean enable) {
+ mTracking = enable;
+ }
+
+ public void setMinTime(long minTime) {
+ }
+
+ public void updateNetworkState(int state, NetworkInfo info) {
+ }
+
+ public void updateLocation(Location location) {
+ if (mTracking) {
+ try {
+ // pass the location back to the location manager
+ mLocationManager.reportLocation(location, true);
+ } catch (RemoteException e) {
+ Log.e(TAG, "RemoteException calling reportLocation");
+ }
+ }
+ }
+
+ public boolean sendExtraCommand(String command, Bundle extras) {
+ return false;
+ }
+
+ public void addListener(int uid) {
+ }
+
+ public void removeListener(int uid) {
+ }
+}
diff --git a/media/libmedia/MediaScanner.cpp b/media/libmedia/MediaScanner.cpp
index f201667..43762e7 100644
--- a/media/libmedia/MediaScanner.cpp
+++ b/media/libmedia/MediaScanner.cpp
@@ -58,7 +58,7 @@
int pathRemaining = PATH_MAX - pathLength;
strcpy(pathBuffer, path);
- if (pathBuffer[pathLength - 1] != '/') {
+ if (pathLength > 0 && pathBuffer[pathLength - 1]) {
pathBuffer[pathLength] = '/';
pathBuffer[pathLength + 1] = 0;
--pathRemaining;
diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp
index 12d7ee2..7997cd6 100644
--- a/media/libstagefright/AudioPlayer.cpp
+++ b/media/libstagefright/AudioPlayer.cpp
@@ -99,13 +99,13 @@
: AudioSystem::CHANNEL_OUT_MONO,
8192, 0, &AudioCallback, this, 0);
- if (mAudioTrack->initCheck() != OK) {
+ if ((err = mAudioTrack->initCheck()) != OK) {
delete mAudioTrack;
mAudioTrack = NULL;
mSource->stop();
- return mAudioTrack->initCheck();
+ return err;
}
mLatencyUs = (int64_t)mAudioTrack->latency() * 1000;
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 1c9f4fd..59a5f9d 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -401,6 +401,9 @@
void AwesomePlayer::onBufferingUpdate() {
Mutex::Autolock autoLock(mLock);
+ if (!mBufferingEventPending) {
+ return;
+ }
mBufferingEventPending = false;
if (mDurationUs >= 0) {
@@ -425,6 +428,9 @@
// Posted whenever any stream finishes playing.
Mutex::Autolock autoLock(mLock);
+ if (!mStreamDoneEventPending) {
+ return;
+ }
mStreamDoneEventPending = false;
if (mFlags & LOOPING) {
@@ -918,6 +924,12 @@
void AwesomePlayer::onCheckAudioStatus() {
Mutex::Autolock autoLock(mLock);
+ if (!mAudioStatusEventPending) {
+ // Event was dispatched and while we were blocking on the mutex,
+ // has already been cancelled.
+ return;
+ }
+
mAudioStatusEventPending = false;
if (mWatchForAudioSeekComplete && !mAudioPlayer->isSeeking()) {
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index e12f2e1..004fcf13 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -71,6 +71,7 @@
import com.android.internal.location.GpsNetInitiatedHandler;
import com.android.internal.location.LocationProviderProxy;
import com.android.internal.location.MockProvider;
+import com.android.internal.location.PassiveProvider;
/**
* The service class that manages LocationProviders and issues location
@@ -452,6 +453,11 @@
mGpsLocationProvider = gpsProvider;
}
+ // create a passive location provider, which is always enabled
+ PassiveProvider passiveProvider = new PassiveProvider(this);
+ addProvider(passiveProvider);
+ mEnabledProviders.add(passiveProvider.getName());
+
// initialize external network location and geocoder services
Resources resources = mContext.getResources();
String serviceName = resources.getString(
@@ -538,7 +544,8 @@
}
private void checkPermissionsSafe(String provider) {
- if (LocationManager.GPS_PROVIDER.equals(provider)
+ if ((LocationManager.GPS_PROVIDER.equals(provider)
+ || LocationManager.PASSIVE_PROVIDER.equals(provider))
&& (mContext.checkCallingOrSelfPermission(ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED)) {
throw new SecurityException("Requires ACCESS_FINE_LOCATION permission");
@@ -554,7 +561,8 @@
}
private boolean isAllowedProviderSafe(String provider) {
- if (LocationManager.GPS_PROVIDER.equals(provider)
+ if ((LocationManager.GPS_PROVIDER.equals(provider)
+ || LocationManager.PASSIVE_PROVIDER.equals(provider))
&& (mContext.checkCallingOrSelfPermission(ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED)) {
return false;
@@ -1343,7 +1351,7 @@
}
}
- public void reportLocation(Location location) {
+ public void reportLocation(Location location, boolean passive) {
if (mContext.checkCallingOrSelfPermission(INSTALL_LOCATION_PROVIDER)
!= PackageManager.PERMISSION_GRANTED) {
throw new SecurityException("Requires INSTALL_LOCATION_PROVIDER permission");
@@ -1351,6 +1359,7 @@
mLocationHandler.removeMessages(MESSAGE_LOCATION_CHANGED, location);
Message m = Message.obtain(mLocationHandler, MESSAGE_LOCATION_CHANGED, location);
+ m.arg1 = (passive ? 1 : 0);
mLocationHandler.sendMessageAtFrontOfQueue(m);
}
@@ -1415,8 +1424,8 @@
return true;
}
- private void handleLocationChangedLocked(Location location) {
- String provider = location.getProvider();
+ private void handleLocationChangedLocked(Location location, boolean passive) {
+ String provider = (passive ? LocationManager.PASSIVE_PROVIDER : location.getProvider());
ArrayList<UpdateRecord> records = mRecordsByProvider.get(provider);
if (records == null || records.size() == 0) {
return;
@@ -1502,17 +1511,20 @@
synchronized (mLock) {
Location location = (Location) msg.obj;
String provider = location.getProvider();
+ boolean passive = (msg.arg1 == 1);
- // notify other providers of the new location
- for (int i = mProviders.size() - 1; i >= 0; i--) {
- LocationProviderInterface p = mProviders.get(i);
- if (!provider.equals(p.getName())) {
- p.updateLocation(location);
+ if (!passive) {
+ // notify other providers of the new location
+ for (int i = mProviders.size() - 1; i >= 0; i--) {
+ LocationProviderInterface p = mProviders.get(i);
+ if (!provider.equals(p.getName())) {
+ p.updateLocation(location);
+ }
}
}
if (isAllowedBySettingsLocked(provider)) {
- handleLocationChangedLocked(location);
+ handleLocationChangedLocked(location, passive);
}
}
}
@@ -1687,6 +1699,10 @@
boolean supportsSpeed, boolean supportsBearing, int powerRequirement, int accuracy) {
checkMockPermissionsSafe();
+ if (LocationManager.PASSIVE_PROVIDER.equals(name)) {
+ throw new IllegalArgumentException("Cannot mock the passive location provider");
+ }
+
long identity = Binder.clearCallingIdentity();
synchronized (mLock) {
MockProvider provider = new MockProvider(name, this,
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index d41aacf..b9bb16f1 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -59,6 +59,10 @@
public static final int TetherStatusResult = 210;
public static final int IpFwdStatusResult = 211;
public static final int InterfaceGetCfgResult = 213;
+ public static final int SoftapStatusResult = 214;
+ public static final int UsbRNDISStatusResult = 215;
+
+ public static final int InterfaceChange = 600;
}
/**
@@ -147,12 +151,35 @@
public void onDaemonConnected() {
new Thread() {
public void run() {
- // XXX: Run some tests
}
}.start();
}
public boolean onEvent(int code, String raw, String[] cooked) {
- return false;
+ if (code == NetdResponseCode.InterfaceChange) {
+ /*
+ * a network interface change occured
+ * Format: "NNN Iface added <name>"
+ * "NNN Iface removed <name>"
+ * "NNN Iface changed <name> <up/down>"
+ */
+ if (cooked.length < 4 || !cooked[1].equals("Iface")) {
+ throw new IllegalStateException(
+ String.format("Invalid event from daemon (%s)", raw));
+ }
+ if (cooked[2].equals("added")) {
+ notifyInterfaceAdded(cooked[3]);
+ return true;
+ } else if (cooked[2].equals("removed")) {
+ notifyInterfaceRemoved(cooked[3]);
+ return true;
+ } else if (cooked[2].equals("changed") && cooked.length == 5) {
+ notifyInterfaceLinkStatusChanged(cooked[3], cooked[4].equals("up"));
+ return true;
+ }
+ throw new IllegalStateException(
+ String.format("Invalid event from daemon (%s)", raw));
+ }
+ return false;
}
}
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 3ecfd8a..47a58cf 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -4638,11 +4638,12 @@
if (activity != null && activity.shortComponentName != null) {
info.append(" (").append(activity.shortComponentName).append(")");
}
+ info.append("\n");
if (annotation != null) {
- info.append("\nReason: ").append(annotation).append("\n");
+ info.append("Reason: ").append(annotation).append("\n");
}
if (parent != null && parent != activity) {
- info.append("\nParent: ").append(parent.shortComponentName);
+ info.append("Parent: ").append(parent.shortComponentName).append("\n");
}
String cpuInfo = null;