搜索

每次半夜睡前不清醒设置miui闹钟总会点到背景而不是完成按钮,然后导致设置的闹钟状态不能保存,甚至有一次导致期末考试迟到。傻逼miui的交互逻辑

(症状:

Screenrecorder-2022-09-06-09-19-49-747

相比之前的天气app,闹钟app没有进行混淆,很方便修改,反编译后直接可以看到com.android.deskclock.alarm.AlarmEditDialogView类,里面的initView()方法中两段代码分别对背景this.mBackgroundView和完成按钮this.mSaveBtn添加了点击监听器。只要将mBackgroundView的点击事件也改为mSaveBtn的即可

this.mBackgroundView = this.mContentView.findViewById(2131361910);
this.mBackgroundView.setOnClickListener(new View.OnClickListener(){
    public void onClick(View view) {
        if (AlarmEditDialogView.this.isShowAnim) {
            return;
        }
        AlarmEditDialogView.this.dismiss();
    }
});
// ......
this.mSaveBtn = (Button)this.mContentView.findViewById(2131362199);
this.mSaveBtn.setOnClickListener(new View.OnClickListener(){

    public void onClick(View view) {
        if (AlarmEditDialogView.this.isShowAnim) {
            return;
        }
        if (AlarmEditDialogView.this.mTimePicker != null) {
            StatHelper.updateAlarmProperties("edit_alarm_hour_picker_slide_times", AlarmEditDialogView.this.mTimePicker.getHourSlideTimes());
            StatHelper.updateAlarmProperties("edit_alarm_min_picker_slide_times", AlarmEditDialogView.this.mTimePicker.getMinSlideTimes());
            OneTrackStatHelper.trackNumEvent(AlarmEditDialogView.this.mTimePicker.getHourSlideTimes(), "479.1.5.1.11815");
            OneTrackStatHelper.trackNumEvent(AlarmEditDialogView.this.mTimePicker.getMinSlideTimes(), "479.1.5.1.11817");
        }
        AlarmEditDialogView.this.dismiss();
        if (AlarmEditDialogView.this.isModified()) {
            ((AlarmEditDialogView)AlarmEditDialogView.this).mOriginalAlarm.hour = AlarmEditDialogView.this.mHour;
            ((AlarmEditDialogView)AlarmEditDialogView.this).mOriginalAlarm.minutes = AlarmEditDialogView.this.mMinute;
            ((AlarmEditDialogView)AlarmEditDialogView.this).mOriginalAlarm.enabled = AlarmEditDialogView.this.mEnableAlarm;
            if (AlarmEditDialogView.this.mOnSaveAlarmListener != null) {
                AlarmEditDialogView.this.mOnSaveAlarmListener.onSaveAlarm(AlarmEditDialogView.this.mOriginalAlarm);
                StatHelper.trackEvent("set_alarm_time", TimeUtil.composeTime(AlarmEditDialogView.this.mHour, AlarmEditDialogView.this.mMinute));
                OneTrackStatHelper.trackNumEvent(AlarmEditDialogView.this.mHour * 60 + AlarmEditDialogView.this.mMinute, "");
            }
        }
        StatHelper.alarmEvent("time_picker_finish_click_count");
        OneTrackStatHelper.trackClickEvent("479.1.4.1.10809");
    }
});

然后再MT管理器里面观察smali代码,背景部分设置点击事件:

    const v1, 0x7f0a0076 # 背景的ID

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    iput-object v0, p0, Lcom/android/deskclock/alarm/AlarmEditDialogView;->mBackgroundView:Landroid/view/View;

    .line 310
    iget-object v0, p0, Lcom/android/deskclock/alarm/AlarmEditDialogView;->mBackgroundView:Landroid/view/View;

    new-instance v1, Lcom/android/deskclock/alarm/AlarmEditDialogView$2;

    invoke-direct {v1, p0}, Lcom/android/deskclock/alarm/AlarmEditDialogView$2;-><init>(Lcom/android/deskclock/alarm/AlarmEditDialogView;)V

    invoke-virtual {v0, v1}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

按钮设置的点击事件:

    const v1, 0x7f0a0197 # 按钮的ID

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/Button;

    iput-object v0, p0, Lcom/android/deskclock/alarm/AlarmEditDialogView;->mSaveBtn:Landroid/widget/Button;

    .line 402
    iget-object v0, p0, Lcom/android/deskclock/alarm/AlarmEditDialogView;->mSaveBtn:Landroid/widget/Button;

    new-instance v1, Lcom/android/deskclock/alarm/AlarmEditDialogView$6;

    invoke-direct {v1, p0}, Lcom/android/deskclock/alarm/AlarmEditDialogView$6;-><init>(Lcom/android/deskclock/alarm/AlarmEditDialogView;)V

    invoke-virtual {v0, v1}, Landroid/widget/Button;->setOnClickListener(Landroid/view/View$OnClickListener;)V

两段代码只有后3行的AlarmEditDialogView$2AlarmEditDialogView$6不一样,直接将背景的$2改为$6即可。

Screenrecorder-2022-09-06-10-38-08-486

版权属于:XanderC
作品采用:本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。
0
查看目录

目录

来自 《[安卓逆向]修改miui闹钟快捷设置的nt交互逻辑》
评论