安卓测试方案及工具

        Stressful Application Test (or stressapptest, its unix name) is a memory interface test.

https://android.googlesource.com/platform/external/stressapptest/

测试方案

        飞行模式:

                settings 控制打开关闭;通过WiFi及扫描判断结果;

        音频:

                AudioManager控制音乐播放;setOnPlayStatusListener监听报错;

        蓝牙:

                BluetoothAdapter开关蓝牙;扫描Classical或LE 设备;接收蓝牙广播;

        相机:

                CameraManager写功能;打开相机;拍照;关闭相机;

        CPU:

                /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed 设置;/proc/stat 查看;

        DDR:

                stresstestapp 测试工具

        Memory:

                单次填充10M;填充80%;

        网络:

                InetAddress.getByName() 测试网址的DNS;

        重启:

                测试应用监听Intent.ACTION_BOOT_COMPLETED;开机自启动; PowerManager.reboot(null);

        Recovery:

                PowerManager.reboot("recovery"); 或者如下方式:

                

private void recovery() {
        if (saveState()) {
            if (mIsWipeAll) {
                try {
                    bootCommand(mActivity, "--wipe_all");
                } catch (IOException e) {
                    Log.e(TAG, "recovery, bootCommand failed: " + e.getMessage());
                }
            } else if (mIsEraseFlash) {
                Intent intent = new Intent("com.android.internal.os.storage.FORMAT_AND_FACTORY_RESET");
                ComponentName componentName = new ComponentName("android", "com.android.internal.os.storage.ExternalStorageFormatter");
                intent.setComponent(componentName);
                intent.putExtra("android.intent.extra.REASON", "WipeAllFlash");
                mActivity.startService(intent);
            } else {
                Intent intent = new Intent("android.intent.action.MASTER_CLEAR");
                intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
                intent.putExtra("android.intent.extra.REASON", "MasterClearConfirm");
                mActivity.sendBroadcast(intent);
            }
            Log.d(TAG, "recovery");
        } else {
            showErrorDialog(R.string.recovery_test_save_state_failed);
        }
    }

        休眠:

                通过闹钟测试;

        定时开机:

                Intent intent = new Intent("com.android.internal.intent.action.REQUEST_SHUTDOWN");

                

Method method = null;
        try {
            method = Class.forName("android.os.ServiceManager").getMethod("getService", String.class);
            IBinder binder = (IBinder) method.invoke(null, new Object[]{"mcu"});
            mMcuService = IMcuService.Stub.asInterface(binder);
        } catch (Exception e) {
            e.printStackTrace();
            setAvailable(false);
        }

        WiFi:

                WifiManager 控制;监听广播;

猜你喜欢

转载自blog.csdn.net/weixin_41693437/article/details/129356669
今日推荐