@@ -103,10 +103,10 @@ private ResPackage readTablePackage() throws IOException, AndrolibException {
103
103
}
104
104
105
105
String name = mIn .readNullEndedString (128 , true );
106
- /* typeStrings */ mIn .skipInt ();
107
- /* lastPublicType */ mIn .skipInt ();
108
- /* keyStrings */ mIn .skipInt ();
109
- /* lastPublicKey */ mIn .skipInt ();
106
+ mIn .skipInt (); // typeStrings
107
+ mIn .skipInt (); // lastPublicType
108
+ mIn .skipInt (); // keyStrings
109
+ mIn .skipInt (); // lastPublicKey
110
110
111
111
// TypeIdOffset was added platform_frameworks_base/@f90f2f8dc36e7243b85e0b6a7fd5a590893c827e
112
112
// which is only in split/new applications.
@@ -191,7 +191,7 @@ private void readOverlaySpec() throws AndrolibException, IOException {
191
191
192
192
private void readOverlayPolicySpec () throws AndrolibException , IOException {
193
193
checkChunkType (Header .XML_TYPE_OVERLAY_POLICY );
194
- /* policyFlags */ mIn .skipInt ();
194
+ mIn .skipInt (); // policyFlags
195
195
int count = mIn .readInt ();
196
196
197
197
for (int i = 0 ; i < count ; i ++) {
@@ -245,7 +245,7 @@ private ResTypeSpec readSingleTableTypeSpec() throws AndrolibException, IOExcept
245
245
mFlagsOffsets .add (new FlagsOffset (mCountIn .getCount (), entryCount ));
246
246
}
247
247
248
- /* flags */ mIn .skipBytes (entryCount * 4 );
248
+ mIn .skipBytes (entryCount * 4 ); // flags
249
249
mTypeSpec = new ResTypeSpec (mTypeNames .getString (id - 1 ), mResTable , mPkg , id , entryCount );
250
250
mPkg .addType (mTypeSpec );
251
251
return mTypeSpec ;
@@ -260,7 +260,7 @@ private ResType readTableType() throws IOException, AndrolibException {
260
260
}
261
261
262
262
int typeFlags = mIn .readByte ();
263
- /* reserved */ mIn .skipBytes (2 );
263
+ mIn .skipBytes (2 ); // reserved
264
264
int entryCount = mIn .readInt ();
265
265
int entriesStart = mIn .readInt ();
266
266
mMissingResSpecMap = new LinkedHashMap ();
@@ -396,8 +396,8 @@ private ResBagValue readComplexEntry() throws IOException, AndrolibException {
396
396
}
397
397
398
398
private ResIntBasedValue readValue () throws IOException , AndrolibException {
399
- /* size */ mIn .skipCheckShort ((short ) 8 );
400
- /* zero */ mIn .skipCheckByte ((byte ) 0 );
399
+ mIn .skipCheckShort ((short ) 8 ); // size
400
+ mIn .skipCheckByte ((byte ) 0 ); // zero
401
401
byte type = mIn .readByte ();
402
402
int data = mIn .readInt ();
403
403
@@ -408,35 +408,61 @@ private ResIntBasedValue readValue() throws IOException, AndrolibException {
408
408
409
409
private ResConfigFlags readConfigFlags () throws IOException , AndrolibException {
410
410
int size = mIn .readInt ();
411
- int read = 28 ;
411
+ int read = 8 ;
412
412
413
- if (size < 28 ) {
414
- throw new AndrolibException ("Config size < 28 " );
413
+ if (size < 8 ) {
414
+ throw new AndrolibException ("Config size < 8 " );
415
415
}
416
416
417
417
boolean isInvalid = false ;
418
418
419
419
short mcc = mIn .readShort ();
420
420
short mnc = mIn .readShort ();
421
421
422
- char [] language = this .unpackLanguageOrRegion (mIn .readByte (), mIn .readByte (), 'a' );
423
- char [] country = this .unpackLanguageOrRegion (mIn .readByte (), mIn .readByte (), '0' );
422
+ char [] language = new char [0 ];
423
+ char [] country = new char [0 ];
424
+ if (size >= 12 ) {
425
+ language = this .unpackLanguageOrRegion (mIn .readByte (), mIn .readByte (), 'a' );
426
+ country = this .unpackLanguageOrRegion (mIn .readByte (), mIn .readByte (), '0' );
427
+ read = 12 ;
428
+ }
424
429
425
- byte orientation = mIn .readByte ();
426
- byte touchscreen = mIn .readByte ();
430
+ byte orientation = 0 ;
431
+ byte touchscreen = 0 ;
432
+ if (size >= 14 ) {
433
+ orientation = mIn .readByte ();
434
+ touchscreen = mIn .readByte ();
435
+ read = 14 ;
436
+ }
427
437
428
- int density = mIn .readUnsignedShort ();
438
+ int density = 0 ;
439
+ if (size >= 16 ) {
440
+ density = mIn .readUnsignedShort ();
441
+ read = 16 ;
442
+ }
429
443
430
- byte keyboard = mIn .readByte ();
431
- byte navigation = mIn .readByte ();
432
- byte inputFlags = mIn .readByte ();
433
- /* inputPad0 */ mIn .skipBytes (1 );
444
+ byte keyboard = 0 ;
445
+ byte navigation = 0 ;
446
+ byte inputFlags = 0 ;
447
+ if (size >= 20 ) {
448
+ keyboard = mIn .readByte ();
449
+ navigation = mIn .readByte ();
450
+ inputFlags = mIn .readByte ();
451
+ mIn .skipBytes (1 ); // inputPad0
452
+ read = 20 ;
453
+ }
434
454
435
- short screenWidth = mIn .readShort ();
436
- short screenHeight = mIn .readShort ();
455
+ short screenWidth = 0 ;
456
+ short screenHeight = 0 ;
457
+ short sdkVersion = 0 ;
458
+ if (size >= 28 ) {
459
+ screenWidth = mIn .readShort ();
460
+ screenHeight = mIn .readShort ();
437
461
438
- short sdkVersion = mIn .readShort ();
439
- /* minorVersion, now must always be 0 */ mIn .skipBytes (2 );
462
+ sdkVersion = mIn .readShort ();
463
+ mIn .skipBytes (2 ); // minorVersion
464
+ read = 28 ;
465
+ }
440
466
441
467
byte screenLayout = 0 ;
442
468
byte uiMode = 0 ;
0 commit comments