-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathkitkat-x86-hacks-ifc6410.patch
558 lines (527 loc) · 23 KB
/
kitkat-x86-hacks-ifc6410.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
project device/generic/armv7-a-neon/
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 80a34cc..a064850 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -25,3 +25,5 @@ WPA_SUPPLICANT_VERSION := VER_0_8_X
USE_OPENGL_RENDERER := true
BOARD_USE_LEGACY_UI := true
+
+WITH_DEXPREOPT := true
project frameworks/base/
diff --git a/api/current.txt b/api/current.txt
index 8e69592..bd21366 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -133,6 +133,7 @@ package android {
field public static final java.lang.String TRANSMIT_IR = "android.permission.TRANSMIT_IR";
field public static final java.lang.String UNINSTALL_SHORTCUT = "com.android.launcher.permission.UNINSTALL_SHORTCUT";
field public static final java.lang.String UPDATE_DEVICE_STATS = "android.permission.UPDATE_DEVICE_STATS";
+ field public static final java.lang.String USB_ACCESS = "android.permission.USB_ACCESS";
field public static final java.lang.String USE_CREDENTIALS = "android.permission.USE_CREDENTIALS";
field public static final java.lang.String USE_SIP = "android.permission.USE_SIP";
field public static final java.lang.String VIBRATE = "android.permission.VIBRATE";
@@ -21790,7 +21791,7 @@ package android.renderscript {
}
public class BaseObj {
- method public synchronized void destroy();
+ method public void destroy();
method public java.lang.String getName();
method public void setName(java.lang.String);
}
project frameworks/native/
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index abadf5e..5d1a91a 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -493,7 +493,7 @@ void HWComposer::eventControl(int disp, int event, int enabled) {
const int32_t oldValue = mDisplayData[disp].events & eventBit;
if (newValue != oldValue) {
ATRACE_CALL();
- err = mHwc->eventControl(mHwc, disp, event, enabled);
+ err = mHwc->eventControl ? mHwc->eventControl(mHwc, disp, event, enabled) : NO_ERROR;
if (!err) {
int32_t& events(mDisplayData[disp].events);
events = (events & ~eventBit) | newValue;
@@ -731,14 +731,15 @@ status_t HWComposer::release(int disp) {
LOG_FATAL_IF(disp >= VIRTUAL_DISPLAY_ID_BASE);
if (mHwc) {
eventControl(disp, HWC_EVENT_VSYNC, 0);
- return (status_t)mHwc->blank(mHwc, disp, 1);
+ if(mHwc->blank)
+ return (status_t)mHwc->blank(mHwc, disp, 1);
}
return NO_ERROR;
}
status_t HWComposer::acquire(int disp) {
LOG_FATAL_IF(disp >= VIRTUAL_DISPLAY_ID_BASE);
- if (mHwc) {
+ if (mHwc && mHwc->blank) {
return (status_t)mHwc->blank(mHwc, disp, 0);
}
return NO_ERROR;
project frameworks/opt/telephony/
diff --git a/src/java/com/android/internal/telephony/gsm/GSMPhone.java b/src/java/com/android/internal/telephony/gsm/GSMPhone.java
index 0e2a73e..a71163d 100644
--- a/src/java/com/android/internal/telephony/gsm/GSMPhone.java
+++ b/src/java/com/android/internal/telephony/gsm/GSMPhone.java
@@ -166,7 +166,7 @@ public class GSMPhone extends PhoneBase {
mCi.setOnUSSD(this, EVENT_USSD, null);
mCi.setOnSuppServiceNotification(this, EVENT_SSN, null);
mSST.registerForNetworkAttached(this, EVENT_REGISTERED_TO_NETWORK, null);
-
+/* allow build with JDK 1.7
if (DBG_PORT) {
try {
//debugSocket = new LocalServerSocket("com.android.internal.telephony.debug");
@@ -201,7 +201,7 @@ public class GSMPhone extends PhoneBase {
Rlog.w(LOG_TAG, "Failure to open com.android.internal.telephony.debug socket", ex);
}
}
-
+*/
//Change the system property
SystemProperties.set(TelephonyProperties.CURRENT_ACTIVE_PHONE,
new Integer(PhoneConstants.PHONE_TYPE_GSM).toString());
project libcore/
diff --git a/libart/src/main/java/java/lang/Enum.java b/libart/src/main/java/java/lang/Enum.java
index f98554a..43ac113 100644
--- a/libart/src/main/java/java/lang/Enum.java
+++ b/libart/src/main/java/java/lang/Enum.java
@@ -148,7 +148,7 @@ public abstract class Enum<E extends Enum<E>> implements Serializable, Comparabl
* @see java.lang.Comparable
*/
public final int compareTo(E o) {
- return ordinal - o.ordinal;
+ return ordinal - o.ordinal();
}
/**
diff --git a/libdvm/src/main/java/java/lang/Enum.java b/libdvm/src/main/java/java/lang/Enum.java
index 7a0f514..4b897aa 100644
--- a/libdvm/src/main/java/java/lang/Enum.java
+++ b/libdvm/src/main/java/java/lang/Enum.java
@@ -147,7 +147,7 @@ public abstract class Enum<E extends Enum<E>> implements Serializable, Comparabl
* @see java.lang.Comparable
*/
public final int compareTo(E o) {
- return ordinal - o.ordinal;
+ return ordinal - o.ordinal();
}
/**
diff --git a/luni/src/main/java/java/security/Security.java b/luni/src/main/java/java/security/Security.java
index 0b6961b..2a0fbbd 100644
--- a/luni/src/main/java/java/security/Security.java
+++ b/luni/src/main/java/java/security/Security.java
@@ -19,6 +19,9 @@ package java.security;
import java.io.BufferedInputStream;
import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
@@ -46,16 +49,25 @@ public final class Security {
// - load security properties files
// - load statically registered providers
// - if no provider description file found then load default providers
+ // Note: Getting the input stream for the security.properties file is factored into its own
+ // function, which will be intercepted during boot image creation.
static {
boolean loaded = false;
+ Reader input = null;
try {
- InputStream configStream = Security.class.getResourceAsStream("security.properties");
- InputStream input = new BufferedInputStream(configStream);
+ input = getSecurityPropertiesReader();
secprops.load(input);
loaded = true;
- configStream.close();
} catch (Exception ex) {
System.logE("Could not load 'security.properties'", ex);
+ } finally {
+ if (input != null) {
+ try {
+ input.close();
+ } catch (Exception ex) {
+ System.logW("Could not close 'security.properties'", ex);
+ }
+ }
}
if (!loaded) {
registerDefaultProviders();
@@ -63,6 +75,11 @@ public final class Security {
Engine.door = new SecurityDoor();
}
+ private static Reader getSecurityPropertiesReader() throws Exception {
+ InputStream configStream = Security.class.getResourceAsStream("security.properties");
+ return new InputStreamReader(new BufferedInputStream(configStream), "ISO-8859-1");
+ }
+
/**
* This class can't be instantiated.
*/
@@ -72,10 +89,9 @@ public final class Security {
// Register default providers
private static void registerDefaultProviders() {
secprops.put("security.provider.1", "com.android.org.conscrypt.OpenSSLProvider");
- secprops.put("security.provider.2", "org.apache.harmony.security.provider.cert.DRLCertFactory");
- secprops.put("security.provider.3", "com.android.org.bouncycastle.jce.provider.BouncyCastleProvider");
- secprops.put("security.provider.4", "org.apache.harmony.security.provider.crypto.CryptoProvider");
- secprops.put("security.provider.5", "com.android.org.conscrypt.JSSEProvider");
+ secprops.put("security.provider.2", "com.android.org.bouncycastle.jce.provider.BouncyCastleProvider");
+ secprops.put("security.provider.3", "org.apache.harmony.security.provider.crypto.CryptoProvider");
+ secprops.put("security.provider.4", "com.android.org.conscrypt.JSSEProvider");
}
/**
@@ -96,7 +112,7 @@ public final class Security {
String prop = "Alg." + propName + "." + algName;
Provider[] providers = getProviders();
for (Provider provider : providers) {
- for (Enumeration e = provider.propertyNames(); e.hasMoreElements(); ) {
+ for (Enumeration<?> e = provider.propertyNames(); e.hasMoreElements();) {
String propertyName = (String) e.nextElement();
if (propertyName.equalsIgnoreCase(prop)) {
return provider.getProperty(propertyName);
@@ -184,7 +200,8 @@ public final class Security {
* @return an array containing all installed providers.
*/
public static synchronized Provider[] getProviders() {
- return Services.getProviders();
+ ArrayList<Provider> providers = Services.getProviders();
+ return providers.toArray(new Provider[providers.size()]);
}
/**
@@ -274,7 +291,7 @@ public final class Security {
if (filter.isEmpty()) {
return null;
}
- java.util.List<Provider> result = Services.getProvidersList();
+ ArrayList<Provider> result = new ArrayList<Provider>(Services.getProviders());
Set<Entry<String, String>> keys = filter.entrySet();
Map.Entry<String, String> entry;
for (Iterator<Entry<String, String>> it = keys.iterator(); it.hasNext();) {
@@ -306,25 +323,23 @@ public final class Security {
if (serv.length() == 0 || alg.length() == 0) {
throw new InvalidParameterException();
}
- Provider p;
- for (int k = 0; k < result.size(); k++) {
- try {
- p = result.get(k);
- } catch (IndexOutOfBoundsException e) {
- break;
- }
- if (!p.implementsAlg(serv, alg, attribute, val)) {
- result.remove(p);
- k--;
- }
- }
+ filterProviders(result, serv, alg, attribute, val);
}
if (result.size() > 0) {
return result.toArray(new Provider[result.size()]);
}
return null;
}
-
+ private static void filterProviders(ArrayList<Provider> providers, String service,
+ String algorithm, String attribute, String attrValue) {
+ Iterator<Provider> it = providers.iterator();
+ while (it.hasNext()) {
+ Provider p = it.next();
+ if (!p.implementsAlg(service, algorithm, attribute, attrValue)) {
+ it.remove();
+ }
+ }
+ }
/**
* Returns the value of the security property named by the argument.
*
@@ -384,9 +399,9 @@ public final class Security {
*
*/
private static void renumProviders() {
- Provider[] p = Services.getProviders();
- for (int i = 0; i < p.length; i++) {
- p[i].setProviderNumber(i + 1);
+ ArrayList<Provider> providers = Services.getProviders();
+ for (int i = 0; i < providers.size(); i++) {
+ providers.get(i).setProviderNumber(i + 1);
}
}
diff --git a/luni/src/main/java/org/apache/harmony/security/fortress/Engine.java b/luni/src/main/java/org/apache/harmony/security/fortress/Engine.java
index f1dd43c..8a39f68 100644
--- a/luni/src/main/java/org/apache/harmony/security/fortress/Engine.java
+++ b/luni/src/main/java/org/apache/harmony/security/fortress/Engine.java
@@ -24,6 +24,7 @@ package org.apache.harmony.security.fortress;
import java.security.NoSuchAlgorithmException;
import java.security.Provider;
+import java.util.ArrayList;
import java.util.Locale;
@@ -31,8 +32,8 @@ import java.util.Locale;
* This class implements common functionality for Provider supplied
* classes. The usage pattern is to allocate static Engine instance
* per service type and synchronize on that instance during calls to
- * {@code getInstance} and retreival of the selected {@code Provider}
- * and Service Provider Interface (SPI) results. Retreiving the
+ * {@code getInstance} and retrieval of the selected {@code Provider}
+ * and Service Provider Interface (SPI) results. Retrieving the
* results with {@code getProvider} and {@code getSpi} sets the
* internal {@code Engine} values to null to prevent memory leaks.
*
@@ -69,8 +70,7 @@ import java.util.Locale;
*
* }</pre>
*/
-public class Engine {
-
+public final class Engine {
/**
* Access to package visible api in java.security
*/
@@ -95,14 +95,13 @@ public class Engine {
/** used to test for cache validity */
private final int cacheVersion;
/** cached result */
- private final Provider.Service service;
-
+ private final ArrayList<Provider.Service> services;
private ServiceCacheEntry(String algorithm,
int cacheVersion,
- Provider.Service service) {
+ ArrayList<Provider.Service> services) {
this.algorithm = algorithm;
this.cacheVersion = cacheVersion;
- this.service = service;
+ this.services = services;
}
}
@@ -118,47 +117,59 @@ public class Engine {
/**
* Creates a Engine object
*
- * @param service
+ * @param serviceName
*/
- public Engine(String service) {
- this.serviceName = service;
+ public Engine(String serviceName) {
+ this.serviceName = serviceName;
}
/**
* Finds the appropriate service implementation and returns an
- * {@code SpiAndProvider} instance containing a reference to SPI
- * and its {@code Provider}
+ * {@code SpiAndProvider} instance containing a reference to the first
+ * matching SPI and its {@code Provider}
*/
public SpiAndProvider getInstance(String algorithm, Object param)
throws NoSuchAlgorithmException {
if (algorithm == null) {
throw new NoSuchAlgorithmException("Null algorithm name");
}
+ ArrayList<Provider.Service> services = getServices(algorithm);
+ if (services == null) {
+ throw notFound(this.serviceName, algorithm);
+ }
+ return new SpiAndProvider(services.get(0).newInstance(param), services.get(0).getProvider());
+ }
+ /**
+ * Finds the appropriate service implementation and returns an
+ * {@code SpiAndProvider} instance containing a reference to SPI
+ * and its {@code Provider}
+ */
+ public SpiAndProvider getInstance(Provider.Service service, String param)
+ throws NoSuchAlgorithmException {
+ return new SpiAndProvider(service.newInstance(param), service.getProvider());
+ }
+ /**
+ * Returns a list of all possible matches for a given algorithm.
+ */
+ public ArrayList<Provider.Service> getServices(String algorithm) {
int newCacheVersion = Services.getCacheVersion();
Provider.Service service;
ServiceCacheEntry cacheEntry = this.serviceCache;
+ final String algoUC = algorithm.toUpperCase(Locale.US);
if (cacheEntry != null
- && cacheEntry.algorithm.equalsIgnoreCase(algorithm)
+ && cacheEntry.algorithm.equalsIgnoreCase(algoUC)
&& newCacheVersion == cacheEntry.cacheVersion) {
- service = cacheEntry.service;
- } else {
- if (Services.isEmpty()) {
- throw notFound(serviceName, algorithm);
- }
- String name = this.serviceName + "." + algorithm.toUpperCase(Locale.US);
- service = Services.getService(name);
- if (service == null) {
- throw notFound(serviceName, algorithm);
- }
- this.serviceCache = new ServiceCacheEntry(algorithm, newCacheVersion, service);
+ return cacheEntry.services;
}
- return new SpiAndProvider(service.newInstance(param), service.getProvider());
+ String name = this.serviceName + "." + algoUC;
+ ArrayList<Provider.Service> services = Services.getServices(name);
+ this.serviceCache = new ServiceCacheEntry(algoUC, newCacheVersion, services);
+ return services;
}
/**
- * Finds the appropriate service implementation and returns and
- * instance of the class that implements corresponding Service
- * Provider Interface.
+ * Finds the appropriate service implementation and returns and instance of
+ * the class that implements corresponding Service Provider Interface.
*/
public Object getInstance(String algorithm, Provider provider, Object param)
throws NoSuchAlgorithmException {
diff --git a/luni/src/main/java/org/apache/harmony/security/fortress/Services.java b/luni/src/main/java/org/apache/harmony/security/fortress/Services.java
index 4fe0d44..a6fb76b 100644
--- a/luni/src/main/java/org/apache/harmony/security/fortress/Services.java
+++ b/luni/src/main/java/org/apache/harmony/security/fortress/Services.java
@@ -38,9 +38,8 @@ public class Services {
* Set the initial size to 600 so we don't grow to 1024 by default because
* initialization adds a few entries more than the growth threshold.
*/
- private static final Map<String, Provider.Service> services
- = new HashMap<String, Provider.Service>(600);
-
+ private static final HashMap<String, ArrayList<Provider.Service>> services
+ = new HashMap<String, ArrayList<Provider.Service>>(600);
/**
* Save default SecureRandom service as well.
* Avoids similar provider/services iteration in SecureRandom constructor.
@@ -62,27 +61,43 @@ public class Services {
/**
* Registered providers.
*/
- private static final List<Provider> providers = new ArrayList<Provider>(20);
+ private static final ArrayList<Provider> providers = new ArrayList<Provider>(20);
+ /**
+ * Try to load and register a provider by name from the given class-loader.
+ */
+ private static boolean initProvider(String providerClassName, ClassLoader classLoader) {
+ try {
+ Class<?> providerClass = Class.forName(providerClassName.trim(), true, classLoader);
+ Provider p = (Provider) providerClass.newInstance();
+ providers.add(p);
+ providersNames.put(p.getName(), p);
+ initServiceInfo(p);
+ return true;
+ } catch (ClassNotFoundException ignored) {
+ } catch (IllegalAccessException ignored) {
+ } catch (InstantiationException ignored) {
+ }
+ return false;
+ }
/**
* Hash for quick provider access by name.
*/
- private static final Map<String, Provider> providersNames = new HashMap<String, Provider>(20);
+ private static final HashMap<String, Provider> providersNames
+ = new HashMap<String, Provider>(20);
static {
String providerClassName = null;
int i = 1;
- ClassLoader cl = ClassLoader.getSystemClassLoader();
+ ClassLoader cl = Services.class.getClassLoader();
while ((providerClassName = Security.getProperty("security.provider." + i++)) != null) {
- try {
- Class providerClass = Class.forName(providerClassName.trim(), true, cl);
- Provider p = (Provider) providerClass.newInstance();
- providers.add(p);
- providersNames.put(p.getName(), p);
- initServiceInfo(p);
- } catch (ClassNotFoundException ignored) {
- } catch (IllegalAccessException ignored) {
- } catch (InstantiationException ignored) {
+ if (!initProvider(providerClassName, cl)) {
+ // Not on the boot classpath. Try the system class-loader.
+ // Note: DO NOT USE A LOCAL FOR GETSYSTEMCLASSLOADER! This will break compile-time
+ // initialization.
+ if (!initProvider(providerClassName, ClassLoader.getSystemClassLoader())) {
+ // TODO: Logging?
+ }
}
}
Engine.door.renumProviders();
@@ -91,8 +106,8 @@ public class Services {
/**
* Returns a copy of the registered providers as an array.
*/
- public static synchronized Provider[] getProviders() {
- return providers.toArray(new Provider[providers.size()]);
+ public static synchronized ArrayList<Provider> getProviders() {
+ return providers;
}
/**
@@ -145,20 +160,27 @@ public class Services {
cachedSecureRandomService = service;
}
String key = type + "." + service.getAlgorithm().toUpperCase(Locale.US);
- if (!services.containsKey(key)) {
- services.put(key, service);
- }
+ appendServiceLocked(key, service);
for (String alias : Engine.door.getAliases(service)) {
key = type + "." + alias.toUpperCase(Locale.US);
- if (!services.containsKey(key)) {
- services.put(key, service);
- }
+ appendServiceLocked(key, service);
}
}
}
/**
- * Returns true if services contain any provider information.
+ * Add or append the service to the key.
+ */
+ private static void appendServiceLocked(String key, Provider.Service service) {
+ ArrayList<Provider.Service> serviceList = services.get(key);
+ if (serviceList == null) {
+ serviceList = new ArrayList<Provider.Service>(1);
+ services.put(key, serviceList);
+ }
+ serviceList.add(service);
+ }
+ /**
+ * Returns true if services does not contain any provider information.
*/
public static synchronized boolean isEmpty() {
return services.isEmpty();
@@ -174,7 +196,7 @@ public class Services {
* caches should be validated against the result of
* Service.getCacheVersion() before use.
*/
- public static synchronized Provider.Service getService(String key) {
+ public static synchronized ArrayList<Provider.Service> getServices(String key) {
return services.get(key);
}
project packages/apps/Gallery2/
diff --git a/src/com/android/gallery3d/util/LinkedNode.java b/src/com/android/gallery3d/util/LinkedNode.java
index 4cfc3cd..9018ba9 100644
--- a/src/com/android/gallery3d/util/LinkedNode.java
+++ b/src/com/android/gallery3d/util/LinkedNode.java
@@ -18,8 +18,8 @@ package com.android.gallery3d.util;
public class LinkedNode {
- private LinkedNode mPrev;
- private LinkedNode mNext;
+ protected LinkedNode mPrev;
+ protected LinkedNode mNext;
public LinkedNode() {
mPrev = mNext = this;
project system/core/
diff --git a/init/util.c b/init/util.c
index 8dd56a1..80a9854 100644
--- a/init/util.c
+++ b/init/util.c
@@ -438,7 +438,7 @@ void get_hardware_name(char *hardware, unsigned int *revision)
if (x) {
x += 2;
n = 0;
- while (*x && *x != '\n') {
+ while (*x && *x != '\n' && *x != '(') {
if (!isspace(*x))
hardware[n++] = tolower(*x);
x++;