Skip to content

Commit d9c17cc

Browse files
author
Jean-Baptiste Queru
committed
merge from gingerbread
Change-Id: I12d6ef65986db41e658bf8d476a8e18c4dd89917
2 parents 0a5ae45 + e59e030 commit d9c17cc

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

core/java/android/provider/Downloads.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,14 @@ private Impl() {}
600600
"android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED";
601601

602602
/**
603-
* The permission to directly access the download manager's cache directory
603+
* The permission to access the all the downloads in the manager.
604+
*/
605+
public static final String PERMISSION_ACCESS_ALL =
606+
"android.permission.ACCESS_ALL_DOWNLOADS";
607+
608+
/**
609+
* The permission to directly access the download manager's cache
610+
* directory
604611
*/
605612
public static final String PERMISSION_CACHE = "android.permission.ACCESS_CACHE_FILESYSTEM";
606613

core/java/com/android/internal/os/BatteryStatsImpl.java

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3079,13 +3079,18 @@ void writeExcessivePowerToParcelLocked(Parcel out) {
30793079
}
30803080
}
30813081

3082-
void readExcessivePowerFromParcelLocked(Parcel in) {
3082+
boolean readExcessivePowerFromParcelLocked(Parcel in) {
30833083
final int N = in.readInt();
30843084
if (N == 0) {
30853085
mExcessivePower = null;
3086-
return;
3086+
return true;
30873087
}
30883088

3089+
if (N > 10000) {
3090+
Slog.w(TAG, "File corrupt: too many excessive power entries " + N);
3091+
return false;
3092+
}
3093+
30893094
mExcessivePower = new ArrayList<ExcessivePower>();
30903095
for (int i=0; i<N; i++) {
30913096
ExcessivePower ew = new ExcessivePower();
@@ -3094,6 +3099,7 @@ void readExcessivePowerFromParcelLocked(Parcel in) {
30943099
ew.usedTime = in.readLong();
30953100
mExcessivePower.add(ew);
30963101
}
3102+
return true;
30973103
}
30983104

30993105
void writeToParcelLocked(Parcel out) {
@@ -4689,7 +4695,7 @@ private void readSummaryFromParcel(Parcel in) {
46894695
}
46904696

46914697
int NW = in.readInt();
4692-
if (NW > 10000) {
4698+
if (NW > 100) {
46934699
Slog.w(TAG, "File corrupt: too many wake locks " + NW);
46944700
return;
46954701
}
@@ -4707,7 +4713,7 @@ private void readSummaryFromParcel(Parcel in) {
47074713
}
47084714

47094715
int NP = in.readInt();
4710-
if (NP > 10000) {
4716+
if (NP > 1000) {
47114717
Slog.w(TAG, "File corrupt: too many sensors " + NP);
47124718
return;
47134719
}
@@ -4720,7 +4726,7 @@ private void readSummaryFromParcel(Parcel in) {
47204726
}
47214727

47224728
NP = in.readInt();
4723-
if (NP > 10000) {
4729+
if (NP > 1000) {
47244730
Slog.w(TAG, "File corrupt: too many processes " + NP);
47254731
return;
47264732
}
@@ -4731,14 +4737,20 @@ private void readSummaryFromParcel(Parcel in) {
47314737
p.mSystemTime = p.mLoadedSystemTime = in.readLong();
47324738
p.mStarts = p.mLoadedStarts = in.readInt();
47334739
int NSB = in.readInt();
4740+
if (NSB > 100) {
4741+
Slog.w(TAG, "File corrupt: too many speed bins " + NSB);
4742+
return;
4743+
}
47344744
p.mSpeedBins = new SamplingCounter[NSB];
47354745
for (int i=0; i<NSB; i++) {
47364746
if (in.readInt() != 0) {
47374747
p.mSpeedBins[i] = new SamplingCounter(mUnpluggables);
47384748
p.mSpeedBins[i].readSummaryFromParcelLocked(in);
47394749
}
47404750
}
4741-
p.readExcessivePowerFromParcelLocked(in);
4751+
if (!p.readExcessivePowerFromParcelLocked(in)) {
4752+
return;
4753+
}
47424754
}
47434755

47444756
NP = in.readInt();
@@ -4751,6 +4763,10 @@ private void readSummaryFromParcel(Parcel in) {
47514763
Uid.Pkg p = u.getPackageStatsLocked(pkgName);
47524764
p.mWakeups = p.mLoadedWakeups = in.readInt();
47534765
final int NS = in.readInt();
4766+
if (NS > 1000) {
4767+
Slog.w(TAG, "File corrupt: too many services " + NS);
4768+
return;
4769+
}
47544770
for (int is = 0; is < NS; is++) {
47554771
String servName = in.readString();
47564772
Uid.Pkg.Serv s = u.getServiceStatsLocked(pkgName, servName);

packages/DefaultContainerService/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.android.defcontainer">
33
<uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER"/>
4+
<uses-permission android:name="android.permission.ACCESS_ALL_DOWNLOADS"/>
45
<uses-permission android:name="android.permission.ASEC_ACCESS"/>
56
<uses-permission android:name="android.permission.ASEC_CREATE"/>
67
<uses-permission android:name="android.permission.ASEC_DESTROY"/>

0 commit comments

Comments
 (0)