Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
bee0735
Purge unused native memory before Zygote fork events
chriswailes Jan 29, 2020
f7e3a0a
Teaches the ProcessCpuTracker about USAPs
chriswailes Mar 4, 2020
e200b31
BGDexopt: Clean up ordering
agampe Jul 25, 2019
65378db
Change USAP name to application name as soon as possible.
chriswailes Apr 23, 2019
a3ad254
Adjusts the USAP pool refill mechanism.
chriswailes May 10, 2019
08cf1c6
Make the USAP Pool refill delay configurable.
chriswailes May 15, 2019
cf3f70e
Resets the refill action/timing info after a pool fill event.
chriswailes May 24, 2019
3d1c24f
Improved timekeeping logic for USAP Pool refill mechanism.
chriswailes Jun 11, 2019
304daa0
Fixed an issue Zygote initialization.
chriswailes Dec 19, 2019
6271d73
Adjust Java Language thread priority in new processes.
chriswailes May 21, 2019
2ba58d5
Moved some thread priority changes.
chriswailes Jun 10, 2019
09fc77f
Re-adds a trace point that was accidentally removed.
chriswailes Jun 11, 2019
06301c3
base: Fix notification LED blink for missed calls
mvaisakh Apr 30, 2020
948ff30
ActivityTaskManagerService: don't show build consistency dialog
shagbag913 Mar 25, 2020
b411f76
(Point) Only calculate sin and cos once
nyancrimew Aug 24, 2018
3fc86f8
Cache KeyStoreService
nyancrimew Jun 5, 2018
03b1945
Cache the global proxy to avoid fetching it for every request
nyancrimew Jun 4, 2018
f3b71d5
Cache pin algorithms in PinSet
nyancrimew Jun 4, 2018
6bd0786
SystemUI: Modify brightness slider icon
imjyotiraditya Apr 2, 2020
592348b
[SQUASH] Some FOD Reverts for new impl
riteshm321 Jun 4, 2020
4493017
FODCircleView: Add support for pressed fod layer
TheScarastic Jun 8, 2020
3729009
FODCircleView: Don't show on certain cases
jhenrique09 Jun 8, 2020
c80d56b
base: Swipe up on keyguard to use Face Unlock [1/2]
SKULSHADY Apr 14, 2020
1ea2c5d
Utils: add method to check if device is connected to Wi-Fi
agxpro May 28, 2020
78765d9
QSHeaderDataUsage: show Wi-Fi usage if device is connected to Wi-Fi
agxpro May 28, 2020
eba1a43
QSHeaderDataUsage: hide usage if device is not connected to internet
agxpro May 28, 2020
2fb8346
QSTiles: improve haptic feedback
agxpro May 27, 2020
7f9467a
move some utils to own class
Genkzsz11 Jun 15, 2020
e9aad08
SystemUI: Fix Ticker layout
SKULSHADY Jun 3, 2020
0e525d3
Zygote: enable zygote preforking (USAP pool) by default
DennySPB Jun 4, 2020
663410b
Pass system server class loader context when asking GetDexOptNeeded
Feb 14, 2020
81da2f1
Remove carrierconfig for emergency notification
May 6, 2020
50e8b77
NetworkTraffic: Fix speed format for 10*KB
neobuddy89 Jun 14, 2020
ecbe658
StichImageUtility: allow taking screenshot on home screen
agxpro May 31, 2020
1d40f18
Nettraff: Clean up
Genkzsz11 Jun 17, 2020
9d16330
FODCircleView: Improve position update
Hikari-no-Tenshi Jun 17, 2020
458905f
Revert "telephony: URI cannot be created with negative subIds"
rohanpurohit Jun 16, 2020
7a394c5
Revert "Screenrecord: Correctly display notification title"
agxpro Apr 29, 2020
38fcdd9
Revert "StichImageUtility: allow taking screenshot on home screen"
Genkzsz11 Jun 20, 2020
8d27147
SystemUI: Don't forcefully convert wallpaper to SRGB
luca020400 Jun 1, 2020
488f5e9
Allow non-system server code to AppOpsManager.checkOp and NoteOp
moltmann Apr 9, 2020
135ddf5
Fix PackageWatchdog::syncRequestsAsync and related code
Aug 27, 2019
afcc99d
framework/base: add parallel verifyV1
Mar 22, 2018
03facd6
Simplifying callback calls in PackageInstallerSession
alexbuy Nov 14, 2019
0107a1e
PackageInstallerSession: Minor refactorings and cleanups
alexbuy Nov 14, 2019
ddd0ac9
SystemUI: Block face authentication when device is in pocket mode
Apr 22, 2020
817cf6b
DO NOT MERGE Make the disconnecting list from activity up-to-date
Feb 2, 2020
c3e5a27
[hwui] fix -Wimplicit-int-float-conversion
nickdesaulniers Oct 10, 2019
b9c1038
lib/androidfw: Fix reversed logic
kongy Aug 30, 2019
22628a3
Revert "SystemUI: Also allow controlling top and bottom corners with …
Genkzsz11 Jun 22, 2020
95028de
DataUsageView: move it to QQS Status Icons area
eyosen Jun 11, 2020
5d29aac
The surface hang up when screen on and screen off
Mar 13, 2019
dcaf011
Revert "Restore "touch response optimizations."""
Genkzsz11 Jun 24, 2020
a0f9e9d
New translations strings.xml (Romanian)
riteshm321 Jun 24, 2020
c1f78d5
New translations strings.xml (Turkish)
riteshm321 Jun 24, 2020
3f09260
New translations strings.xml (Norwegian)
riteshm321 Jun 24, 2020
74d722c
New translations du_strings.xml (Norwegian)
riteshm321 Jun 24, 2020
b81a60a
New translations strings.xml (Polish)
riteshm321 Jun 24, 2020
3650695
New translations du_strings.xml (Polish)
riteshm321 Jun 24, 2020
3384ca3
New translations strings.xml (Portuguese)
riteshm321 Jun 24, 2020
2164def
New translations du_strings.xml (Portuguese)
riteshm321 Jun 24, 2020
6afa89b
New translations strings.xml (Russian)
riteshm321 Jun 24, 2020
4556392
New translations du_strings.xml (Russian)
riteshm321 Jun 24, 2020
cbca97c
New translations strings.xml (Serbian (Cyrillic))
riteshm321 Jun 24, 2020
d209ed8
New translations du_strings.xml (Serbian (Cyrillic))
riteshm321 Jun 24, 2020
e2742ac
New translations strings.xml (Swedish)
riteshm321 Jun 24, 2020
bbb01bf
New translations du_strings.xml (Swedish)
riteshm321 Jun 24, 2020
1e4d243
New translations du_strings.xml (Turkish)
riteshm321 Jun 24, 2020
9a5ad71
New translations strings.xml (Dutch)
riteshm321 Jun 24, 2020
994b276
New translations strings.xml (Ukrainian)
riteshm321 Jun 24, 2020
b42c159
New translations du_strings.xml (Ukrainian)
riteshm321 Jun 24, 2020
22ac0c4
New translations strings.xml (Chinese Simplified)
riteshm321 Jun 24, 2020
b65c0c1
New translations du_strings.xml (Chinese Simplified)
riteshm321 Jun 24, 2020
2885c97
New translations strings.xml (Chinese Traditional)
riteshm321 Jun 24, 2020
df67ebe
New translations du_strings.xml (Chinese Traditional)
riteshm321 Jun 24, 2020
565811d
New translations strings.xml (English)
riteshm321 Jun 24, 2020
08dfb94
New translations du_strings.xml (English)
riteshm321 Jun 24, 2020
c5e5f68
New translations strings.xml (Vietnamese)
riteshm321 Jun 24, 2020
ae39385
New translations du_strings.xml (Vietnamese)
riteshm321 Jun 24, 2020
9f61af8
New translations strings.xml (Portuguese, Brazilian)
riteshm321 Jun 24, 2020
c978293
New translations du_strings.xml (Portuguese, Brazilian)
riteshm321 Jun 24, 2020
d3ab2c3
New translations strings.xml (Hindi)
riteshm321 Jun 24, 2020
f967a48
New translations du_strings.xml (Dutch)
riteshm321 Jun 24, 2020
755bd97
New translations du_strings.xml (Korean)
riteshm321 Jun 24, 2020
9f218b6
New translations du_strings.xml (Romanian)
riteshm321 Jun 24, 2020
b4ab6f9
New translations du_strings.xml (Danish)
riteshm321 Jun 24, 2020
aafee99
New translations strings.xml (French)
riteshm321 Jun 24, 2020
157f1a5
New translations du_strings.xml (French)
riteshm321 Jun 24, 2020
7466962
New translations strings.xml (Spanish)
riteshm321 Jun 24, 2020
31c313c
New translations du_strings.xml (Spanish)
riteshm321 Jun 24, 2020
22f21e2
New translations strings.xml (Afrikaans)
riteshm321 Jun 24, 2020
a0bdba3
New translations du_strings.xml (Afrikaans)
riteshm321 Jun 24, 2020
3bd2ea2
New translations strings.xml (Arabic)
riteshm321 Jun 24, 2020
54d908c
New translations du_strings.xml (Arabic)
riteshm321 Jun 24, 2020
a1a6d65
New translations strings.xml (Catalan)
riteshm321 Jun 24, 2020
41611c2
New translations du_strings.xml (Catalan)
riteshm321 Jun 24, 2020
46bcde8
New translations strings.xml (Czech)
riteshm321 Jun 24, 2020
4dfe1ed
New translations du_strings.xml (Czech)
riteshm321 Jun 24, 2020
55d46c1
New translations strings.xml (Danish)
riteshm321 Jun 24, 2020
6c1caba
New translations strings.xml (German)
riteshm321 Jun 24, 2020
b23b662
New translations strings.xml (Korean)
riteshm321 Jun 24, 2020
0cec4b4
New translations du_strings.xml (German)
riteshm321 Jun 24, 2020
905bdf4
New translations strings.xml (Greek)
riteshm321 Jun 24, 2020
74186f3
New translations du_strings.xml (Greek)
riteshm321 Jun 24, 2020
429997c
New translations strings.xml (Finnish)
riteshm321 Jun 24, 2020
e2146d9
New translations du_strings.xml (Finnish)
riteshm321 Jun 24, 2020
a248970
New translations strings.xml (Hebrew)
riteshm321 Jun 24, 2020
dafe3c4
New translations du_strings.xml (Hebrew)
riteshm321 Jun 24, 2020
4697f22
New translations strings.xml (Hungarian)
riteshm321 Jun 24, 2020
c113688
New translations du_strings.xml (Hungarian)
riteshm321 Jun 24, 2020
2e5b7d6
New translations strings.xml (Italian)
riteshm321 Jun 24, 2020
3c1fc8c
New translations du_strings.xml (Italian)
riteshm321 Jun 24, 2020
72dd694
New translations strings.xml (Japanese)
riteshm321 Jun 24, 2020
d8279ae
New translations du_strings.xml (Japanese)
riteshm321 Jun 24, 2020
6112634
New translations du_strings.xml (Hindi)
riteshm321 Jun 24, 2020
4af3e9e
New translations du_strings.xml (Romanian)
riteshm321 Jun 24, 2020
ac2480c
New translations du_strings.xml (Norwegian)
riteshm321 Jun 24, 2020
cf0976e
New translations du_strings.xml (Indonesian)
riteshm321 Jun 24, 2020
c267511
New translations du_strings.xml (Indonesian)
riteshm321 Jun 24, 2020
46db199
New translations du_strings.xml (Portuguese, Brazilian)
riteshm321 Jun 24, 2020
3c168ea
New translations du_strings.xml (Vietnamese)
riteshm321 Jun 24, 2020
5a42629
New translations du_strings.xml (English)
riteshm321 Jun 24, 2020
c6fb33d
New translations du_strings.xml (Chinese Traditional)
riteshm321 Jun 24, 2020
e8099d5
New translations du_strings.xml (Chinese Simplified)
riteshm321 Jun 24, 2020
8e08914
New translations du_strings.xml (Ukrainian)
riteshm321 Jun 24, 2020
05cfcc6
New translations du_strings.xml (Turkish)
riteshm321 Jun 24, 2020
a4487e3
New translations du_strings.xml (Swedish)
riteshm321 Jun 24, 2020
47d2fab
New translations du_strings.xml (Serbian (Cyrillic))
riteshm321 Jun 24, 2020
1a142ae
New translations du_strings.xml (Russian)
riteshm321 Jun 24, 2020
ca343b2
New translations du_strings.xml (Portuguese)
riteshm321 Jun 24, 2020
4cef943
New translations du_strings.xml (Polish)
riteshm321 Jun 24, 2020
b70d604
New translations du_strings.xml (Dutch)
riteshm321 Jun 24, 2020
b0b349b
New translations du_strings.xml (French)
riteshm321 Jun 24, 2020
84182b5
New translations du_strings.xml (Korean)
riteshm321 Jun 24, 2020
5d8d5d3
New translations du_strings.xml (Japanese)
riteshm321 Jun 24, 2020
0dab391
New translations du_strings.xml (Italian)
riteshm321 Jun 24, 2020
b2535aa
New translations du_strings.xml (Hungarian)
riteshm321 Jun 24, 2020
759f324
New translations du_strings.xml (Hebrew)
riteshm321 Jun 24, 2020
b6f6b29
New translations du_strings.xml (Finnish)
riteshm321 Jun 24, 2020
f291975
New translations du_strings.xml (Greek)
riteshm321 Jun 24, 2020
a70a1ae
New translations du_strings.xml (German)
riteshm321 Jun 24, 2020
6e69d7c
New translations du_strings.xml (Danish)
riteshm321 Jun 24, 2020
efe97b6
New translations du_strings.xml (Czech)
riteshm321 Jun 24, 2020
6dad8b3
New translations du_strings.xml (Catalan)
riteshm321 Jun 24, 2020
3263152
New translations du_strings.xml (Arabic)
riteshm321 Jun 24, 2020
4bae3a9
New translations du_strings.xml (Afrikaans)
riteshm321 Jun 24, 2020
ae1bc41
New translations du_strings.xml (Spanish)
riteshm321 Jun 24, 2020
7a0cedb
New translations du_strings.xml (Hindi)
riteshm321 Jun 24, 2020
6cc7a5a
New translations du_strings.xml (Portuguese, Brazilian)
riteshm321 Jun 24, 2020
5a2f485
New translations du_strings.xml (Spanish)
riteshm321 Jun 25, 2020
fe1b316
New translations du_strings.xml (Arabic)
riteshm321 Jun 25, 2020
319b40a
New translations du_strings.xml (Hungarian)
riteshm321 Jun 25, 2020
cc9c625
New translations du_strings.xml (Russian)
riteshm321 Jun 25, 2020
ddaa174
New translations du_strings.xml (Portuguese, Brazilian)
riteshm321 Jun 25, 2020
18d63b4
New translations du_strings.xml (Portuguese, Brazilian)
riteshm321 Jun 25, 2020
73dc266
New translations du_strings.xml (Indonesian)
riteshm321 Jun 25, 2020
d861517
New translations du_strings.xml (Indonesian)
riteshm321 Jun 25, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/java/android/app/ActivityManagerInternal.java
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public abstract ComponentName startServiceInPackage(int uid, Intent service,
String resolvedType, boolean fgRequired, String callingPackage, int userId,
boolean allowBackgroundActivityStarts) throws TransactionTooLargeException;

public abstract void disconnectActivityFromServices(Object connectionHolder, Object conns);
public abstract void disconnectActivityFromServices(Object connectionHolder);
public abstract void cleanUpServices(int userId, ComponentName component, Intent baseIntent);
public abstract ActivityInfo getActivityInfoForUser(ActivityInfo aInfo, int userId);
public abstract void ensureBootCompleted();
Expand Down
11 changes: 6 additions & 5 deletions core/java/android/app/ActivityThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -4333,13 +4333,14 @@ public void handleResumeActivity(IBinder token, boolean finalStateRequest, boole
l.softInputMode = (l.softInputMode
& (~WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION))
| forwardBit;
if (r.activity.mVisibleFromClient) {
ViewManager wm = a.getWindowManager();
View decor = r.window.getDecorView();
wm.updateViewLayout(decor, l);
}
}

if (r.activity.mVisibleFromClient) {
ViewManager wm = a.getWindowManager();
View decor = r.window.getDecorView();
wm.updateViewLayout(decor, l);
}

r.activity.mVisibleFromServer = true;
mNumVisibleActivities++;
if (r.activity.mVisibleFromClient) {
Expand Down
32 changes: 19 additions & 13 deletions core/java/android/net/Network.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ public class Network implements Parcelable {
// code search audits are possible.
private final transient boolean mPrivateDnsBypass;

private java.net.Proxy mProxy = null;

/**
* @hide
*/
Expand Down Expand Up @@ -315,6 +317,22 @@ private void maybeInitUrlConnectionFactory() {
}
}

private java.net.Proxy getProxy() throws IOException {
if (mProxy == null) {
final ConnectivityManager cm = ConnectivityManager.getInstanceOrNull();
if (cm == null) {
throw new IOException("No ConnectivityManager yet constructed, please construct one");
}
final ProxyInfo proxyInfo = cm.getProxyForNetwork(this);
if (proxyInfo != null) {
mProxy = proxyInfo.makeProxy();
} else {
mProxy = java.net.Proxy.NO_PROXY;
}
}
return mProxy;
}

/**
* Opens the specified {@link URL} on this {@code Network}, such that all traffic will be sent
* on this Network. The URL protocol must be {@code HTTP} or {@code HTTPS}.
Expand All @@ -325,19 +343,7 @@ private void maybeInitUrlConnectionFactory() {
* @see java.net.URL#openConnection()
*/
public URLConnection openConnection(URL url) throws IOException {
final ConnectivityManager cm = ConnectivityManager.getInstanceOrNull();
if (cm == null) {
throw new IOException("No ConnectivityManager yet constructed, please construct one");
}
// TODO: Should this be optimized to avoid fetching the global proxy for every request?
final ProxyInfo proxyInfo = cm.getProxyForNetwork(this);
final java.net.Proxy proxy;
if (proxyInfo != null) {
proxy = proxyInfo.makeProxy();
} else {
proxy = java.net.Proxy.NO_PROXY;
}
return openConnection(url, proxy);
return openConnection(url, getProxy());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion core/java/android/os/ZygoteProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class ZygoteProcess {
* not be used if the devices has a DeviceConfig profile pushed to it that contains a value for
* this key.
*/
private static final String USAP_POOL_ENABLED_DEFAULT = "false";
private static final String USAP_POOL_ENABLED_DEFAULT = "true";

/**
* The name of the socket used to communicate with the primary zygote.
Expand Down
6 changes: 6 additions & 0 deletions core/java/android/provider/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -11445,6 +11445,12 @@ public boolean validate(@Nullable String value) {
*/
public static final String HARDWARE_KEYS_ENABLE = "hardware_keys_enable";

/**
* Whether face unlock is allowed only on security view.
* @hide
*/
public static final String FACE_UNLOCK_ALWAYS_REQUIRE_SWIPE = "face_unlock_always_require_swipe";

/**
* This are the settings to be backed up.
*
Expand Down
10 changes: 6 additions & 4 deletions core/java/android/security/net/config/PinSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

/** @hide */
public final class PinSet {
private static Set<String> algorithms;
public static final PinSet EMPTY_PINSET =
new PinSet(Collections.<Pin>emptySet(), Long.MAX_VALUE);
public final long expirationTime;
Expand All @@ -36,10 +37,11 @@ public PinSet(Set<Pin> pins, long expirationTime) {
}

Set<String> getPinAlgorithms() {
// TODO: Cache this.
Set<String> algorithms = new ArraySet<String>();
for (Pin pin : pins) {
algorithms.add(pin.digestAlgorithm);
if(algorithms == null){
algorithms = new ArraySet<String>();
for (Pin pin : pins) {
algorithms.add(pin.digestAlgorithm);
}
}
return algorithms;
}
Expand Down
134 changes: 110 additions & 24 deletions core/java/android/util/apk/ApkSignatureVerifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import android.content.pm.PackageParser.SigningDetails.SignatureSchemeVersion;
import android.content.pm.Signature;
import android.os.Trace;
import android.util.ArrayMap;
import android.util.Slog;
import android.util.jar.StrictJarFile;

import com.android.internal.util.ArrayUtils;
Expand All @@ -46,6 +48,9 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.zip.ZipEntry;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.LinkedBlockingQueue;

/**
* Facade class that takes care of the details of APK verification on
Expand All @@ -57,6 +62,12 @@ public class ApkSignatureVerifier {

private static final AtomicReference<byte[]> sBuffer = new AtomicReference<>();

private static final String TAG = "ApkSignatureVerifier";

// multithread verification
private static final int NUMBER_OF_CORES =
Runtime.getRuntime().availableProcessors() >= 4 ? 4 : Runtime.getRuntime().availableProcessors() ;

/**
* Verifies the provided APK and returns the certificates associated with each signer.
*
Expand Down Expand Up @@ -160,8 +171,9 @@ public static PackageParser.SigningDetails verify(String apkPath,
private static PackageParser.SigningDetails verifyV1Signature(
String apkPath, boolean verifyFull)
throws PackageParserException {
StrictJarFile jarFile = null;

int objectNumber = verifyFull ? NUMBER_OF_CORES : 1;
StrictJarFile[] jarFile = new StrictJarFile[objectNumber];
final ArrayMap<String, StrictJarFile> strictJarFiles = new ArrayMap<String, StrictJarFile>();
try {
final Certificate[][] lastCerts;
final Signature[] lastSigs;
Expand All @@ -170,21 +182,23 @@ private static PackageParser.SigningDetails verifyV1Signature(

// we still pass verify = true to ctor to collect certs, even though we're not checking
// the whole jar.
jarFile = new StrictJarFile(
apkPath,
true, // collect certs
verifyFull); // whether to reject APK with stripped v2 signatures (b/27887819)
for (int i = 0; i < objectNumber; i++) {
jarFile[i] = new StrictJarFile(
apkPath,
true, // collect certs
verifyFull); // whether to reject APK with stripped v2 signatures (b/27887819)
}
final List<ZipEntry> toVerify = new ArrayList<>();

// Gather certs from AndroidManifest.xml, which every APK must have, as an optimization
// to not need to verify the whole APK when verifyFUll == false.
final ZipEntry manifestEntry = jarFile.findEntry(
final ZipEntry manifestEntry = jarFile[0].findEntry(
PackageParser.ANDROID_MANIFEST_FILENAME);
if (manifestEntry == null) {
throw new PackageParserException(INSTALL_PARSE_FAILED_BAD_MANIFEST,
"Package " + apkPath + " has no manifest");
}
lastCerts = loadCertificates(jarFile, manifestEntry);
lastCerts = loadCertificates(jarFile[0], manifestEntry);
if (ArrayUtils.isEmpty(lastCerts)) {
throw new PackageParserException(INSTALL_PARSE_FAILED_NO_CERTIFICATES, "Package "
+ apkPath + " has no certificates at entry "
Expand All @@ -194,7 +208,7 @@ private static PackageParser.SigningDetails verifyV1Signature(

// fully verify all contents, except for AndroidManifest.xml and the META-INF/ files.
if (verifyFull) {
final Iterator<ZipEntry> i = jarFile.iterator();
final Iterator<ZipEntry> i = jarFile[0].iterator();
while (i.hasNext()) {
final ZipEntry entry = i.next();
if (entry.isDirectory()) continue;
Expand All @@ -205,24 +219,93 @@ private static PackageParser.SigningDetails verifyV1Signature(

toVerify.add(entry);
}

class VerificationData {
public Exception exception;
public int exceptionFlag;
public boolean wait;
public int index;
public Object objWaitAll;
public boolean shutDown;
}
VerificationData vData = new VerificationData();
vData.objWaitAll = new Object();
final ThreadPoolExecutor verificationExecutor = new ThreadPoolExecutor(
NUMBER_OF_CORES,
NUMBER_OF_CORES,
1,/*keep alive time*/
TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>());
for (ZipEntry entry : toVerify) {
final Certificate[][] entryCerts = loadCertificates(jarFile, entry);
if (ArrayUtils.isEmpty(entryCerts)) {
throw new PackageParserException(INSTALL_PARSE_FAILED_NO_CERTIFICATES,
"Package " + apkPath + " has no certificates at entry "
+ entry.getName());
Runnable verifyTask = new Runnable(){
public void run() {
try {
if (vData.exceptionFlag != 0 ) {
Slog.w(TAG, "VerifyV1 exit with exception " + vData.exceptionFlag);
return;
}
String tid = Long.toString(Thread.currentThread().getId());
StrictJarFile tempJarFile;
synchronized (strictJarFiles) {
tempJarFile = strictJarFiles.get(tid);
if (tempJarFile == null) {
if (vData.index >= NUMBER_OF_CORES) {
vData.index = 0;
}
tempJarFile = jarFile[vData.index++];
strictJarFiles.put(tid, tempJarFile);
}
}
final Certificate[][] entryCerts = loadCertificates(tempJarFile, entry);
if (ArrayUtils.isEmpty(entryCerts)) {
throw new PackageParserException(INSTALL_PARSE_FAILED_NO_CERTIFICATES,
"Package " + apkPath + " has no certificates at entry "
+ entry.getName());
}

// make sure all entries use the same signing certs
final Signature[] entrySigs = convertToSignatures(entryCerts);
if (!Signature.areExactMatch(lastSigs, entrySigs)) {
throw new PackageParserException(
INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES,
"Package " + apkPath + " has mismatched certificates at entry "
+ entry.getName());
}
} catch (GeneralSecurityException e) {
synchronized (vData.objWaitAll) {
vData.exceptionFlag = INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING;
vData.exception = e;
}
} catch (PackageParserException e) {
synchronized (vData.objWaitAll) {
vData.exceptionFlag = INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION;
vData.exception = e;
}
}
}};
synchronized (vData.objWaitAll) {
if (vData.exceptionFlag == 0) {
verificationExecutor.execute(verifyTask);
}
}

// make sure all entries use the same signing certs
final Signature[] entrySigs = convertToSignatures(entryCerts);
if (!Signature.areExactMatch(lastSigs, entrySigs)) {
throw new PackageParserException(
INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES,
"Package " + apkPath + " has mismatched certificates at entry "
+ entry.getName());
}
vData.wait = true;
verificationExecutor.shutdown();
while (vData.wait) {
try {
if (vData.exceptionFlag != 0 && !vData.shutDown) {
Slog.w(TAG, "verifyV1 Exception " + vData.exceptionFlag);
verificationExecutor.shutdownNow();
vData.shutDown = true;
}
vData.wait = !verificationExecutor.awaitTermination(50,
TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
Slog.w(TAG,"VerifyV1 interrupted while awaiting all threads done...");
}
}
if (vData.exceptionFlag != 0)
throw new PackageParserException(vData.exceptionFlag,
"Failed to collect certificates from " + apkPath, vData.exception);
}
return new PackageParser.SigningDetails(lastSigs, SignatureSchemeVersion.JAR);
} catch (GeneralSecurityException e) {
Expand All @@ -232,8 +315,11 @@ private static PackageParser.SigningDetails verifyV1Signature(
throw new PackageParserException(INSTALL_PARSE_FAILED_NO_CERTIFICATES,
"Failed to collect certificates from " + apkPath, e);
} finally {
strictJarFiles.clear();
Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
closeQuietly(jarFile);
for (int i = 0; i < objectNumber ; i++) {
closeQuietly(jarFile[i]);
}
}
}

Expand Down
Loading