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);
|
}
|
}
|