a
554325746@qq.com
2019-12-24 570a73851c26d810c2597596a8acc8a8d4cde211
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package com.basic.security.utils;
 
import android.content.Context;
import android.content.Intent;
 
/**
 * 设备相关操作 工具类
 * Created by DELL on 2018/11/30.
 */
public class DeviceControl {
    private static final String ACTION_CAMERA_HDR = "com.alf.camera.hdr";
    private static final String KEY_CAMERA_HDR = "key_camera_hdr";
 
    /**
     * 摄像头宽动态控制
     *
     * @param context
     * @param state   true开启 false关闭
     */
    public static void configCameraHdr(Context context, boolean state) {
        Intent camerIntent = new Intent(ACTION_CAMERA_HDR);
        camerIntent.putExtra("enabled", state ? "true" : "false");
        context.sendBroadcast(camerIntent);
    }
 
    /**
     * 设备重启
     *
     * @param context
     */
    public static void deviceRestart(Context context) {
        Intent devIntent = new Intent();
        devIntent.setAction("com.alf.reboot.system");
        context.sendBroadcast(devIntent);
    }
 
    /**
     * 隐藏导航栏
     *
     * @param context 一次发送,隐藏,再发一次,恢复
     */
    public static void shieldNavigationBar(Context context) {
        Intent intent1 = new Intent();
        intent1.setAction("com.alf.switch_status_bar");
        context.sendBroadcast(intent1);
    }
 
    /**
     * 屏蔽底部导航
     *
     * @param context
     * @param state   true开启 false关闭
     */
    public static void devicesTatusbar(Context context, boolean state) {
        Intent sbarIntent = new Intent();
        sbarIntent.setAction("com.alf.disable.statusbar");
        sbarIntent.putExtra("disable", state ? "true" : "false");
        context.sendBroadcast(sbarIntent);
    }
 
    /**
     * 设置应用为launcher
     * 需要再androidManifest添加
     * 启动的activity 需要设置为 HOME LAUNCHER
     * <intent-filter>
     * <action android:name="android.intent.action.MAIN"/>
     * <category android:name="android.intent.category.LAUNCHER"/>
     * <category android:name="android.intent.category.HOME"/>
     * <category android:name="android.intent.category.DEFAULT"/>
     * </intent-filter>
     *
     * @param context
     * @param pkgname 包名
     */
    public static void setApplicationLauncher(Context context, String pkgname) {
        Intent intentLauncher = new Intent();
        //设置launcher 广播
        intentLauncher.setAction("com.alf.set.default.launcher");
        intentLauncher.putExtra("pkgname", pkgname);
        context.sendBroadcast(intentLauncher);
    }
}