.field protected static final rebootOptions:[Ljava/lang/String;
.field protected static final rebootString:[Ljava/lang/String;
变量的名字叫做rebootString,是稍后用来显示的。
3、继续往下看,第38行后:
.method static constructor ()V
.registers 3 ——声明使用3个寄存器
const/4 v0, 0x4 ——v0=4
new-array v0, v0, [Ljava/lang/String; ——建立新数组,容量为v0,即4
const/4 v1, 0x0 ——v1=0
const-string v2, "Normal" ——v2=Normal
aput-object v2, v0, v1 ——v0数组中的第v1个值为v2,即数组中的第一个为Normal(至于0为什么是第一个就不提了,0123就是1234)
const/4 v1, 0x1
const-string v2, "Hot restart"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string v2, "Bootloader"
aput-object v2, v0, v1
const/4 v1, 0x3
const-string v2, "Recovery"
aput-object v2, v0, v1
sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String; ——rebootOptions就从v0数组中取值了,作为操作数
上段原来的代码,有必要的地方都加了注释,会代码的仔细看一看吧。原来的代码,不难看出,这里只定义了给rebootOptions提供参数的一个容量为4的数组。同样,仿照它,再定义一个容量为4的数组,来给上边定义过的rebootString提供参数。
.method static constructor ()V
.registers 8
const/4 v7, 0x4
const/4 v6, 0x3
const/4 v5, 0x2
const/4 v4, 0x1
const/4 v3, 0x0
new-array v0, v7, [Ljava/lang/String; ——新的数组v0,容量为v7(4)
const-string v2, "\u6B63\u5E38\u91CD\u542F" ——“正常重启”的转码结果赋值给v2
aput-object v2, v0, v3 ——数组v0的第v3位为v2
const-string v2, "\u5FEB\u901F\u91CD\u542F" ——“快速重启”
aput-object v2, v0, v4
const-string v2, "\u5F15\u5BFC\u6A21\u5F0F" ——“引导模式”
aput-object v2, v0, v5
const-string v2, "\u5237\u673A\u6A21\u5F0F" ——“刷机模式”
aput-object v2, v0, v6
sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootString:[Ljava/lang/String; ——数组定义完毕,rebootString的参数将从数组v0中读取
new-array v1, v7, [Ljava/lang/String;
const-string v2, "Normal"
aput-object v2, v1, v3
const-string v2, "Hot restart"
aput-object v2, v1, v4
const-string v2, "Bootloader"
aput-object v2, v1, v5
const-string v2, "Recovery"
aput-object v2, v1, v6
sput-object v1, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
sget-object v2, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;