Merge change 2017 into donut
* changes: Increment BatteryStatsImpl's VERSION. That'll make it stop trying to interpret older records with the new format. Also applied other comments involving name changes to remove un-needed 'Wifi' labels in WifiManager API, etc.
This commit is contained in:
@ -55,7 +55,7 @@ public final class BatteryStatsImpl extends BatteryStats {
|
|||||||
private static final int MAGIC = 0xBA757475; // 'BATSTATS'
|
private static final int MAGIC = 0xBA757475; // 'BATSTATS'
|
||||||
|
|
||||||
// Current on-disk Parcel version
|
// Current on-disk Parcel version
|
||||||
private static final int VERSION = 34;
|
private static final int VERSION = 35;
|
||||||
|
|
||||||
private final File mFile;
|
private final File mFile;
|
||||||
private final File mBackupFile;
|
private final File mBackupFile;
|
||||||
|
@ -96,8 +96,8 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
private int mScanLocksAcquired;
|
private int mScanLocksAcquired;
|
||||||
private int mScanLocksReleased;
|
private int mScanLocksReleased;
|
||||||
|
|
||||||
private final List<WifiMulticaster> mMulticasters =
|
private final List<Multicaster> mMulticasters =
|
||||||
new ArrayList<WifiMulticaster>();
|
new ArrayList<Multicaster>();
|
||||||
private int mMulticastEnabled;
|
private int mMulticastEnabled;
|
||||||
private int mMulticastDisabled;
|
private int mMulticastDisabled;
|
||||||
|
|
||||||
@ -1744,7 +1744,7 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class WifiLock extends WifiDeathRecipient {
|
private class WifiLock extends DeathRecipient {
|
||||||
WifiLock(int lockMode, String tag, IBinder binder) {
|
WifiLock(int lockMode, String tag, IBinder binder) {
|
||||||
super(lockMode, tag, binder);
|
super(lockMode, tag, binder);
|
||||||
}
|
}
|
||||||
@ -1887,13 +1887,13 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
return hadLock;
|
return hadLock;
|
||||||
}
|
}
|
||||||
|
|
||||||
private abstract class WifiDeathRecipient
|
private abstract class DeathRecipient
|
||||||
implements IBinder.DeathRecipient {
|
implements IBinder.DeathRecipient {
|
||||||
String mTag;
|
String mTag;
|
||||||
int mMode;
|
int mMode;
|
||||||
IBinder mBinder;
|
IBinder mBinder;
|
||||||
|
|
||||||
WifiDeathRecipient(int mode, String tag, IBinder binder) {
|
DeathRecipient(int mode, String tag, IBinder binder) {
|
||||||
super();
|
super();
|
||||||
mTag = tag;
|
mTag = tag;
|
||||||
mMode = mode;
|
mMode = mode;
|
||||||
@ -1906,13 +1906,13 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class WifiMulticaster extends WifiDeathRecipient {
|
private class Multicaster extends DeathRecipient {
|
||||||
WifiMulticaster(String tag, IBinder binder) {
|
Multicaster(String tag, IBinder binder) {
|
||||||
super(Binder.getCallingUid(), tag, binder);
|
super(Binder.getCallingUid(), tag, binder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void binderDied() {
|
public void binderDied() {
|
||||||
Log.e(TAG, "WifiMulticaster binderDied");
|
Log.e(TAG, "Multicaster binderDied");
|
||||||
synchronized (mMulticasters) {
|
synchronized (mMulticasters) {
|
||||||
int i = mMulticasters.indexOf(this);
|
int i = mMulticasters.indexOf(this);
|
||||||
if (i != -1) {
|
if (i != -1) {
|
||||||
@ -1922,7 +1922,7 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "WifiMulticaster{" + mTag + " binder=" + mBinder + "}";
|
return "Multicaster{" + mTag + " binder=" + mBinder + "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUid() {
|
public int getUid() {
|
||||||
@ -1930,12 +1930,12 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enableWifiMulticast(IBinder binder, String tag) {
|
public void enableMulticast(IBinder binder, String tag) {
|
||||||
enforceChangePermission();
|
enforceChangePermission();
|
||||||
|
|
||||||
synchronized (mMulticasters) {
|
synchronized (mMulticasters) {
|
||||||
mMulticastEnabled++;
|
mMulticastEnabled++;
|
||||||
mMulticasters.add(new WifiMulticaster(tag, binder));
|
mMulticasters.add(new Multicaster(tag, binder));
|
||||||
// Note that we could call stopPacketFiltering only when
|
// Note that we could call stopPacketFiltering only when
|
||||||
// our new size == 1 (first call), but this function won't
|
// our new size == 1 (first call), but this function won't
|
||||||
// be called often and by making the stopPacket call each
|
// be called often and by making the stopPacket call each
|
||||||
@ -1953,7 +1953,7 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disableWifiMulticast() {
|
public void disableMulticast() {
|
||||||
enforceChangePermission();
|
enforceChangePermission();
|
||||||
|
|
||||||
int uid = Binder.getCallingUid();
|
int uid = Binder.getCallingUid();
|
||||||
@ -1961,7 +1961,7 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
mMulticastDisabled++;
|
mMulticastDisabled++;
|
||||||
int size = mMulticasters.size();
|
int size = mMulticasters.size();
|
||||||
for (int i = size - 1; i >= 0; i--) {
|
for (int i = size - 1; i >= 0; i--) {
|
||||||
WifiMulticaster m = mMulticasters.get(i);
|
Multicaster m = mMulticasters.get(i);
|
||||||
if ((m != null) && (m.getUid() == uid)) {
|
if ((m != null) && (m.getUid() == uid)) {
|
||||||
removeMulticasterLocked(i, uid);
|
removeMulticasterLocked(i, uid);
|
||||||
}
|
}
|
||||||
@ -1985,7 +1985,7 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWifiMulticastEnabled() {
|
public boolean isMulticastEnabled() {
|
||||||
enforceAccessPermission();
|
enforceAccessPermission();
|
||||||
|
|
||||||
synchronized (mMulticasters) {
|
synchronized (mMulticasters) {
|
||||||
|
@ -70,10 +70,10 @@ interface IWifiManager
|
|||||||
|
|
||||||
boolean releaseWifiLock(IBinder lock);
|
boolean releaseWifiLock(IBinder lock);
|
||||||
|
|
||||||
boolean isWifiMulticastEnabled();
|
boolean isMulticastEnabled();
|
||||||
|
|
||||||
void enableWifiMulticast(IBinder binder, String tag);
|
void enableMulticast(IBinder binder, String tag);
|
||||||
|
|
||||||
void disableWifiMulticast();
|
void disableMulticast();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -831,9 +831,9 @@ public class WifiManager {
|
|||||||
*
|
*
|
||||||
* @hide pending API council approval
|
* @hide pending API council approval
|
||||||
*/
|
*/
|
||||||
public boolean isWifiMulticastEnabled() {
|
public boolean isMulticastEnabled() {
|
||||||
try {
|
try {
|
||||||
return mService.isWifiMulticastEnabled();
|
return mService.isMulticastEnabled();
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -851,13 +851,13 @@ public class WifiManager {
|
|||||||
*
|
*
|
||||||
* @return true on success
|
* @return true on success
|
||||||
*
|
*
|
||||||
* @see #disableWifiMulticast
|
* @see #disableMulticast
|
||||||
*
|
*
|
||||||
* @hide pending API council approval
|
* @hide pending API council approval
|
||||||
*/
|
*/
|
||||||
public boolean enableWifiMulticast(String tag) {
|
public boolean enableMulticast(String tag) {
|
||||||
try {
|
try {
|
||||||
mService.enableWifiMulticast(new Binder(), tag);
|
mService.enableMulticast(new Binder(), tag);
|
||||||
return true;
|
return true;
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
return false;
|
return false;
|
||||||
@ -872,13 +872,13 @@ public class WifiManager {
|
|||||||
*
|
*
|
||||||
* @return true on success
|
* @return true on success
|
||||||
*
|
*
|
||||||
* @see #enableWifiMulticast
|
* @see #enableMulticast
|
||||||
*
|
*
|
||||||
* @hide pending API council approval
|
* @hide pending API council approval
|
||||||
*/
|
*/
|
||||||
public boolean disableWifiMulticast() {
|
public boolean disableMulticast() {
|
||||||
try {
|
try {
|
||||||
mService.disableWifiMulticast();
|
mService.disableMulticast();
|
||||||
return true;
|
return true;
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -747,8 +747,8 @@ public class WifiStateTracker extends NetworkStateTracker {
|
|||||||
* first and then off.. if nobody else wants it on it'll be
|
* first and then off.. if nobody else wants it on it'll be
|
||||||
* off then and it's all synchronized within the API.
|
* off then and it's all synchronized within the API.
|
||||||
*/
|
*/
|
||||||
mWM.enableWifiMulticast("WifiStateTracker");
|
mWM.enableMulticast("WifiStateTracker");
|
||||||
mWM.disableWifiMulticast();
|
mWM.disableMulticast();
|
||||||
|
|
||||||
if (mBluetoothA2dp == null) {
|
if (mBluetoothA2dp == null) {
|
||||||
mBluetoothA2dp = new BluetoothA2dp(mContext);
|
mBluetoothA2dp = new BluetoothA2dp(mContext);
|
||||||
|
Reference in New Issue
Block a user