The hardcoded number
I assume you're viewing a compiled app's AndroidManifest.xml
. Typically in production code the XML flag attribute would look like this:
android:configChanges="locale|orientation|screenSize"
1204
is a decimal value.
Interestingly I just opened the same file in my app's APK and configChanges
was a hexadecimal value. It's indicated by 0x
prefix, e.g. 1204
dec would be 0x4b4
hex. I'll also mention binary numbers for completeness' sake - they'll be used in an example below.
Now this is beyond my knowledge, but I guess the difference may be somewhere between AAPT2 versions or it may be applied by an additional code optimizer like R8 or ProGuard.
configChanges
and bit masking
is 1204 a known value associated with the attribute.
Kind of. It's one of possible combinations of configChanges
flags. They are known, there are just a lot of them.
For example, take a look at this pair of constants (or any other pair, which you'll find nearby in these files):
locale
flag in configChanges
attribute in attrs_manifest.xml
.
android.content.pm.ActivityInfo.CONFIG_LOCALE
The value of these represents a bit in configChanges
, which itself is a bit mask. This means that having just the value of configChanges
you can check which of all these flags are enabled and which are disabled.
Checking enabled flags
We can use an online tool such as BitwiseCmd to perform bitwise operations on those values.
For example, we can perform an AND operation on 1204
and the locale
flag:
1204 & 0x0004
0000010010110100 // 1204 (configChanges bit mask)
& 0000000000000100 // 0x0004 (locale bit)
= 0000000000000100 // 4
This means that in 1204
the locale
flag is enabled and the Activity
will not be recreated when system locale (language) changes.
In simple terms an Activity
represents a window on your screen.
Let's check the uiMode
flag for contrast:
1204 & 0x0200
0000010010110100 // 1204 (configChanges bit mask)
& 0000001000000000 // 0x0200 (uiMode bit)
= 0000000000000000 // 0
This means that in 1204
the uiMode
flag is disabled and the Activity
will be recreated whenever UI mode (day/night) changes.
Here's an example on how how to check those flags in Java.
I am searching for some answers as to what is going on with my phone.
Are there any issues you're encountering or is this just pure curiosity?