Commit ba198072 by app_dev@sobot.com

智齿远程控制 安卓被控端sdk(使用的是第三方向日葵)

parents
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
# Gradle files
.gradle/
build/
app/build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Android Studio Navigation editor temp files
.navigation/
# Android Studio captures folder
captures/
# Intellij
*.iml
.idea/
\ No newline at end of file
apply plugin: 'com.android.application'
static def releaseTime() {
return new Date().format("yyyyMMddHHmm", TimeZone.getDefault())//包含时分秒
}
android {
compileSdkVersion 28
buildToolsVersion "28.0.2"
defaultConfig {
applicationId "com.sobot.sunlogin.screencapturesdk"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
multiDexEnabled true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
sourceSets {
main {
jniLibs.srcDirs 'src/main/libs'
jni.srcDirs = [] // disable automatic ndk-build call
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "sobot_client-sdk-v1.0-${releaseTime()}.apk"
}
}
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
dexOptions {
javaMaxHeapSize "4g" //specify the heap size for the dex process
dexInProcess true
preDexLibraries false
}
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '28.0.0'
}
}
}
}
dependencies {
implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
implementation 'com.google.zxing:core:3.3.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.alibaba.android:vlayout:1.2.19@aar'
implementation files('libs/screenserver-1.4.jar')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
runtimeOnly files('libs/supportlib.jar')
compileOnly files('libs/knoxsdk.jar')
implementation 'com.sobot.library:net:0.1'
implementation 'com.sobot.library:gson:0.1'
implementation 'com.squareup.okhttp3:okhttp:4.4.0'
}
repositories{
flatDir {
dirs 'libs'
}
}
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Android\android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.sobot.screencapturesdk">
<!-- android:sharedUserId="android.uid.system" -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.sec.MDM_REMOTE_CONTROL" />
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_REMOTE_CONTROL" />
<uses-permission android:name="android.permission.sec.MDM_HW_CONTROL" />
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_HW_CONTROL" />
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_CUSTOM_SYSTEM" />
<uses-permission android:name="com.sec.enterprise.knox.permission.CUSTOM_SYSTEM" />
<application
android:name=".application.SobotApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".activity.SobotSplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activity.SobotHomeActivity"
android:configChanges="orientation|keyboardHidden|screenLayout|screenSize|keyboard"
android:exported="true"
android:launchMode="singleInstance"
android:windowSoftInputMode="stateUnchanged">
<intent-filter>
<action android:name="com.sobot.cuptercontrol" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<service
android:name="com.oray.sunlogin.service.AdbSimpleIME"
android:label="ADB Simple Keyboard"
android:permission="android.permission.BIND_INPUT_METHOD">
<intent-filter>
<action android:name="android.view.InputMethod" />
</intent-filter>
<meta-data
android:name="android.view.im"
android:resource="@xml/methods" />
</service> <!-- Enable selective Knox permissions(optional) -->
<receiver
android:name="com.oray.sunlogin.receiver.KnoxAdminReceiver"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<meta-data
android:name="android.app.device_admin"
android:resource="@xml/device_admin_receiver" />
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>
</application>
</manifest>
\ No newline at end of file
package com.sobot.screencapturesdk.activity;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.media.MediaCodecInfo;
import android.media.projection.MediaProjectionManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.oray.sunlogin.bean.CodecParameter;
import com.oray.sunlogin.interfaces.IDisplayInfo;
import com.oray.sunlogin.manager.ClientSdkManager;
import com.oray.sunlogin.util.ThreadPoolManage;
import com.oray.sunlogin.utils.KnoxUtils;
import com.sobot.gson.SobotGsonUtil;
import com.sobot.network.apiUtils.SobotBaseUrl;
import com.sobot.network.apiUtils.SobotHttpUtils;
import com.sobot.network.http.HttpUtils;
import com.sobot.network.http.log.SobotNetLogUtils;
import com.sobot.screencapturesdk.R;
import com.sobot.screencapturesdk.factory.DisplayInfoFactory;
import com.sobot.screencapturesdk.module.SobotResultModule;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.RequestBody;
import static android.os.Build.VERSION.SDK_INT;
import static com.oray.sunlogin.util.CommandLineDesc.INPUTAGENT;
import static com.oray.sunlogin.util.CommandLineDesc.INPUTAGENT5;
import static com.oray.sunlogin.util.CommandLineDesc.SCREENAGENT;
/**
* liboraysceen_agentn.so的运行参数:-p xxx -l xxx
* 传递参数时,请用十进制值
* 例如:-p 1 -l 32
* 例如:-p 1 -l 64
* <p>
* -p (h264 profile type) //OMX_VIDEO_AVCPROFILETYPE
* Constants are declared in {@link MediaCodecInfo.CodecProfileLevel}.
* -p 的参数,请使用1
* <p>
* -l (h264 profile Level) //OMX_VIDEO_AVCLEVELTYPE
* Constants are declared in {@link MediaCodecInfo.CodecProfileLevel}.
* -l 的参数,请使用AVCLevel22(128)以下的值
* <p>
* liborayinput_agentn.so的运行参数:-o
* 传递参数时,请用十进制值(0/90/180/270)
* 例如:-o 90
*/
public class SobotHomeActivity extends Activity implements View.OnClickListener, ClientSdkManager.IAcceptListener, ClientSdkManager.IFileTransferListener {
private static final String TAG = "SunloginClientSDK";
private static final String LOCAL_TEMP_PATH = "/data/local/tmp/";
/**
* 可修改成定制后的app的沙盒路径
*/
//private static final String APP_SANDBOXPATH = "/data/data/com.sobot.sunlogin.screencapturesdk/lib/";
private static final String PLUGIN_NAME_DESKTOP = "desktop";
private static final String PLUGIN_NAME_SCREENSHOT = "screenshots";
private static final String PLUGIN_NAME_FILEMANAGER = "file";
private static final String PLUGIN_NAME_FILETRANSFER = "filetrans";
private Timer mTimer;
private EditText mEditTextsessionid;
private TextView mStatusTextView;
private Button mLoginButton;
private Button mLogoutButton;
private String mAddress;
private static final int WHAT_SHOW_TIMER = 0;
private static final int WHAT_SHOW_STATUS = 1;
private static final int WHAT_SHOW_TOAST = 2;
private static final int WHAT_CREATE_SESSIONID = 4;
private CommonHandler mHandler;
private int totalTimes = 0;
private boolean mCancel = false;
private HashMap<String, String> mSessionPlugins;
private ExecutorService mSingleExecutor = Executors.newSingleThreadExecutor();
/**
* app的沙盒路径,如/data/app/com.sobot.sunlogin.screencapturesdk-2/
*/
private String mSandboxPath;
private String defaultSandboxPath = "/data/data/com.sobot.sunlogin.screencapturesdk/lib/";
/**
* 申请request media projection返回的结果
*/
private Intent mResultData; // cache
private MediaProjectionManager mMediaProjectionManager;
private int REQUEST_CODE = 100;
/**
* 设置system权限签名的变量,ture: 需要system签名
*/
public boolean mIsSystem = false; //是否是system权限
public boolean mIsUseInjectEvents = true; //system权限远程控制下,是否使用INJECT_EVENTS权限去实现控制功能
public boolean mIsAllowKonx = false; //是否使用三星免root方式实现远程控制(此变量禁止直接修改,得使用Samsung Konx SDK检查)
// public boolean mDefaultLandscape = false; //custom
// private final String ARG_INPUT_AGENT_LANDSCAPE = " -o 90 -a"; //custom
private final String ARG_INPUT_AGENT = " -o 0";
private final String ARG_SCREEN_AGENT = " -p 1 -l 128";
private String baseurl ="chat-remote-assistance/remote-assistance";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mSessionPlugins = new HashMap<>();
initView();
initListener();
initSdkManager();
mSandboxPath = ClientSdkManager.getSandboxPath(this);
mHandler = new CommonHandler(Looper.getMainLooper());
}
private void initView() {
findViewById(R.id.tv_timer).setVisibility(View.INVISIBLE);
mLoginButton = findViewById(R.id.btn_login);
mLogoutButton = findViewById(R.id.btn_logout);
mStatusTextView = findViewById(R.id.tv_status);
mEditTextsessionid = findViewById(R.id.edit_sessionid);
}
private void initListener() {
mLoginButton.setOnClickListener(this);
mLogoutButton.setOnClickListener(this);
}
private void initSdkManager() {
ClientSdkManager.getInstance().initialize(getApplicationContext(), new DisplayInfoFactory(getApplicationContext()));
ClientSdkManager.getInstance().setCaptureListener((errorCode, message) -> {
Message msg = mHandler.obtainMessage();
msg.what = WHAT_SHOW_STATUS;
msg.arg1 = errorCode;
msg.obj = message;
mHandler.sendMessage(msg);
});
ClientSdkManager.getInstance().setAcceptListener(this);
ClientSdkManager.getInstance().setFileTransferListener(this);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
mResultData = data;
//用户确认,开启录屏服务
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ClientSdkManager.getInstance().stopCapture();
ClientSdkManager.getInstance().initCapture(mResultData, mMediaProjectionManager, new DisplayInfoFactory(getApplicationContext()));
}
}
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btn_login:
handleLogin(mEditTextsessionid.getText().toString().trim());
sendToast("已开始登录");
break;
case R.id.btn_logout:
handleEnd();
break;
default:
break;
}
}
private void handleLogin(String sessionid) {
if (TextUtils.isEmpty(sessionid)) {
Toast.makeText(SobotHomeActivity.this, "sessionid 不能为空", Toast.LENGTH_SHORT).show();
return;
}
// 更改状态提示, 并禁用登录按钮
mStatusTextView.setText("未连接, 正在连接");
enableLoginButton(false, false);
Map<String, String> params = new HashMap<>();
params.put("sessionid", sessionid);
SobotHttpUtils.doGet(SobotHomeActivity.this, SobotBaseUrl.getApi_Host()+baseurl+"/1/sessions/" + sessionid + "/license", params, new HttpUtils.StringCallBack() {
@Override
public void onResponse(String result) {
if (!TextUtils.isEmpty(result)) {
SobotResultModule resultModule = SobotGsonUtil.JsonToBean(result, SobotResultModule.class);
if (resultModule != null && !TextUtils.isEmpty(resultModule.getRetCode()) && "000000".equals(resultModule.getRetCode())) {
Future future = mSingleExecutor.submit(() -> {
if (resultModule.getItem() != null) {
ClientSdkManager.getInstance().loginWithLicense(resultModule.getItem().getP2pAddress(),
resultModule.getItem().getLicense());
} else {
ClientSdkManager.getInstance().loginWithLicense("PHSRC://101.200.154.142:4118;PHSRC_HTTPS://101.200.154.142:3443;",
"SHA1:wrxfqqap;LgvHor1h4K0EJNzOPUpvUrE5wns=");
}
});
try {
if (future.get() == null)
Log.i(TAG, "111111");
} catch (Exception e) {
e.printStackTrace();
Log.i(TAG, "Exception: " + e.getMessage());
}
} else {
enableLoginButton(true, false);
if (resultModule != null) {
mStatusTextView.setText("登录失败: " + resultModule.getRetMsg());
}
}
}
}
@Override
public void onError(Exception e, String msg, int responseCode) {
e.printStackTrace();
}
@Override
public void inProgress(int progress) {
}
});
}
private void handleEnd() {
RequestBody requestBodyJson = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), "{\n" +
" \"role\": \"user\", \"sessionId\": \"" + mEditTextsessionid.getText().toString().trim() + "\"\n" +
"}");
okhttp3.Request requestPostJson = new okhttp3.Request.Builder()
.url(SobotBaseUrl.getApi_Host()+baseurl+"/1/sdk/end")
.post(requestBodyJson)
.build();
OkHttpClient okHttpClientPostJson = new OkHttpClient();
okHttpClientPostJson.newCall(requestPostJson).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
String message = e != null ? e.getMessage() : "";
Log.e(TAG, "onFailure: " + message);
}
@Override
public void onResponse(Call call, okhttp3.Response response) throws IOException {
String body = response.body().string();
SobotNetLogUtils.i(body);
if (!TextUtils.isEmpty(body)) {
SobotResultModule resultModule = SobotGsonUtil.JsonToBean(body, SobotResultModule.class);
if (!TextUtils.isEmpty(resultModule.getRetCode()) && "000000".equals(resultModule.getRetCode())) {
ClientSdkManager.getInstance().stopCapture();
ClientSdkManager.getInstance().restoreInputMethod();
handleLogout();
sendToast("已经登出");
}
}
}
});
}
private void handleLogout() {
Future future = mSingleExecutor.submit(() -> ClientSdkManager.getInstance().logout());
try {
if (future.get() == null) {
}
} catch (Exception e) {
e.printStackTrace();
}
}
@SuppressLint("SetTextI18n")
private void createSession(String plugin, String sessionid) {
mAddress = ClientSdkManager.getInstance().getAddress();
String session = ClientSdkManager.getInstance().createSession(plugin);
mSessionPlugins.put(plugin, session);
Log.i(TAG, "ADDRESS: " + mAddress + "\nSession: " + session);
RequestBody requestBodyJson = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), "{\n" +
" \"sessionClient\": {\n" +
" \"clientAddress\": \"" + mAddress + "\",\n" +
" \"clientId\": \"" + session + "\",\n" +
" \"soundId\": \"\"\n" +
" },\n" +
" \"sessionId\": \"" + sessionid + "\"\n" +
"}");
okhttp3.Request requestPostJson = new okhttp3.Request.Builder()
.url(SobotBaseUrl.getApi_Host()+baseurl+"/1/user/accept")
.post(requestBodyJson)
.build();
OkHttpClient okHttpClientPostJson = new OkHttpClient();
okHttpClientPostJson.newCall(requestPostJson).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
e.printStackTrace();
}
@Override
public void onResponse(Call call, okhttp3.Response response) throws IOException {
String body = response.body().string();
SobotNetLogUtils.i("接受远控:" + body);
if (!TextUtils.isEmpty(body)) {
SobotResultModule resultModule = SobotGsonUtil.JsonToBean(body, SobotResultModule.class);
if (resultModule != null) {
if (!TextUtils.isEmpty(resultModule.getRetCode()) && "000000".equals(resultModule.getRetCode())) {
SobotHomeActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (PLUGIN_NAME_DESKTOP.compareToIgnoreCase(plugin) == 0) {
if (SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
//开启屏幕录屏弹框
startMediaProjection();
}
if (mIsAllowKonx) {
ClientSdkManager.getInstance().setAllowKonx(mIsAllowKonx);
} else if (mIsSystem && mIsUseInjectEvents) {
ClientSdkManager.getInstance().setIsSystem(mIsSystem);
} else if (mIsSystem) {
runTaskWithSystem();
} else {
runTaskWithRoot();
}
} else if (PLUGIN_NAME_FILETRANSFER.compareToIgnoreCase(plugin) == 0) {
//ClientSdkManager.getInstance().setSavePath("/sdcard/download/");
}
}
});
} else {
mStatusTextView.setText("连接失败: " + resultModule.getRetMsg());
}
}
}
}
});
}
private void destroySession(String plugin) {
String session = mSessionPlugins.get(plugin);
if (!TextUtils.isEmpty(session)) {
ClientSdkManager.getInstance().destroySession(session);
}
if (PLUGIN_NAME_DESKTOP.compareToIgnoreCase(plugin) == 0) {
if (SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
//停止录屏服务
ClientSdkManager.getInstance().stopCapture();
}
//还原默认输入法
ClientSdkManager.getInstance().restoreInputMethod();
//杀掉所有相关so
killSdkInputProcess((!mIsSystem && !mIsAllowKonx));
}
}
private void destroyAllSession() {
for (HashMap.Entry<String, String> entry : mSessionPlugins.entrySet()) {
String session = mSessionPlugins.get(entry.getValue());
if (!TextUtils.isEmpty(session)) {
ClientSdkManager.getInstance().destroySession(session);
}
if (PLUGIN_NAME_DESKTOP.compareToIgnoreCase(entry.getKey()) == 0) {
if (SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
//停止录屏服务
ClientSdkManager.getInstance().stopCapture();
}
//还原默认输入法
ClientSdkManager.getInstance().restoreInputMethod();
//杀掉所有相关so
killSdkInputProcess((!mIsSystem && !mIsAllowKonx));
}
}
}
/**
* 使用root权限启动task
*/
private void runTaskWithRoot() {
Log.i(TAG, "runTaskWithRoot, sdk " + SDK_INT);
//请求root权限
ThreadPoolManage.getShortPool().execute(() -> {
// 判断手机是否root
if (ClientSdkManager.isRootAvailable()) {
// 判断应用是否获得root权限
if (ClientSdkManager.isRootPermission()) {
//先查杀
killSdkInputProcess(true);
//高于5.0, 21
if (SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ThreadPoolManage.getShortPool().execute(() -> ClientSdkManager.LaunchExternalProcess(mSandboxPath, LOCAL_TEMP_PATH, INPUTAGENT5, getInputArgs(), true));
} else if (SDK_INT >= Build.VERSION_CODES.KITKAT && SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
ThreadPoolManage.getShortPool().execute(() -> ClientSdkManager.LaunchExternalProcess(mSandboxPath, LOCAL_TEMP_PATH, INPUTAGENT, getInputArgs(), true));
ThreadPoolManage.getShortPool().execute(() -> ClientSdkManager.LaunchExternalProcess(defaultSandboxPath, LOCAL_TEMP_PATH, SCREENAGENT, "", true));
}
checkControlService(true);
} else {
// 获取root权限失败
Log.i(TAG, "isRootPermission: false");
sendToast("isRootPermission: false");
}
} else {
// 手机未root
Log.i(TAG, "isRootAvailable: false");
sendToast("isRootAvailable: false");
}
});
}
/**
* 使用system权限启动task
*/
private void runTaskWithSystem() {
Log.i(TAG, "runTaskWithSystem, sdk " + SDK_INT);
ThreadPoolManage.getShortPool().execute((Runnable) () -> {
//先查杀
killSdkInputProcess(false);
if (SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {//高于5.0, 21
ThreadPoolManage.getShortPool().execute(() ->
ClientSdkManager.LaunchExternalProcess(mSandboxPath, LOCAL_TEMP_PATH, INPUTAGENT5, getInputArgs(), false));
} else if (SDK_INT >= Build.VERSION_CODES.KITKAT && SDK_INT < Build.VERSION_CODES.LOLLIPOP) {//
ThreadPoolManage.getShortPool().execute(() ->
ClientSdkManager.LaunchExternalProcess(mSandboxPath, LOCAL_TEMP_PATH, INPUTAGENT, getInputArgs(), false));
ThreadPoolManage.getShortPool().execute(() ->
ClientSdkManager.LaunchExternalProcess(defaultSandboxPath, LOCAL_TEMP_PATH, SCREENAGENT, getScreenArgs(), false));
}
checkControlService(false);
});
}
/**
* 开启线程定时检查控制进程是否存在
*/
private void checkControlService(final boolean bNeedRoot) {
Log.i(TAG, "checkControlService, current root status: " + bNeedRoot);
if (mTimer == null) {
mTimer = new Timer();
TimerTask timerTask = new TimerTask() {
@Override
public void run() {
String tempInputAgent;
if (SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
tempInputAgent = INPUTAGENT5;
} else {
tempInputAgent = INPUTAGENT;
}
boolean isInputAgentExist = ClientSdkManager.searchProcess(tempInputAgent, ClientSdkManager.FILTER_INPUTAGENT, bNeedRoot);
if (!isInputAgentExist && null != mTimer) {
Log.i(TAG, INPUTAGENT + " is not exist(1), start again...");
if (SDK_INT >= 21) {
ClientSdkManager.LaunchExternalProcess(mSandboxPath, LOCAL_TEMP_PATH, INPUTAGENT5, getInputArgs(), bNeedRoot);
} else if (SDK_INT >= Build.VERSION_CODES.KITKAT && SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
ClientSdkManager.LaunchExternalProcess(mSandboxPath, LOCAL_TEMP_PATH, INPUTAGENT, getInputArgs(), bNeedRoot);
}
}
if (SDK_INT >= Build.VERSION_CODES.KITKAT && SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
boolean isScreenAgentExist = ClientSdkManager.searchProcess(SCREENAGENT, ClientSdkManager.FILTER_SCREENAGENT, bNeedRoot);
if (!isScreenAgentExist && null != mTimer) {
Log.i(TAG, SCREENAGENT + " is not exist(2), start again...");
ClientSdkManager.LaunchExternalProcess(defaultSandboxPath, LOCAL_TEMP_PATH, SCREENAGENT, getScreenArgs(), bNeedRoot);
}
}
}
};
mTimer.schedule(timerTask, 1000, 15000);
}
}
/**
* 清除input agent 进程
*
* @param bNeedRoot
*/
private void killSdkInputProcess(boolean bNeedRoot) {
Log.i(TAG, "first Kill SO, current root status: " + bNeedRoot);
if (SDK_INT >= 21) {
ClientSdkManager.searchAndKillProcess(INPUTAGENT5, ClientSdkManager.FILTER_INPUTAGENT, bNeedRoot);
} else if (SDK_INT >= 19 && SDK_INT < 21) {
ClientSdkManager.searchAndKillProcess(SCREENAGENT, ClientSdkManager.FILTER_SCREENAGENT, bNeedRoot);
ClientSdkManager.searchAndKillProcess(INPUTAGENT, ClientSdkManager.FILTER_INPUTAGENT, bNeedRoot);
}
}
/**
* 开启获取录像弹窗
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void startMediaProjection() {
mMediaProjectionManager = (MediaProjectionManager) getSystemService(Context.MEDIA_PROJECTION_SERVICE);
//可以每次都重新获取录屏权限也可以读上一次的缓存信息
Intent captureIntent = mMediaProjectionManager.createScreenCaptureIntent();
startActivityForResult(captureIntent, REQUEST_CODE);
}
/**
* 重置编码参数
*
* @param displayInfo
* @param parameter
*/
private void resetCodecParameter(IDisplayInfo displayInfo, CodecParameter parameter) {
ClientSdkManager.getInstance().resetCodecParameter(displayInfo, parameter);
}
@Override
public void onStatusChanged(int status, int error, String extra) {
Log.i(TAG, "call onStatusChanged, status: " + status + " !!!");
switch (status) {
case ClientSdkManager.IAcceptListener.STATUS_CONNECT:
mStatusTextView.setText("已成功连接");
enableLoginButton(false, true);
Log.i(TAG, "extra : " + extra);
break;
case ClientSdkManager.IAcceptListener.STATUS_DISCONNECT:
mStatusTextView.setText("连接已经断开");
enableLoginButton(true, false);
// enableSessionButton(false);
// destroyAllSession();
break;
case ClientSdkManager.IAcceptListener.STATUS_LOGIN_OK:
mStatusTextView.setText("已成功登录服务器");
enableLoginButton(false, true);
Message msg = mHandler.obtainMessage();
msg.what = WHAT_CREATE_SESSIONID;
mHandler.sendMessage(msg);
break;
case ClientSdkManager.IAcceptListener.STATUS_LOGIN_FAIL:
mStatusTextView.setText("登录失败,请确认网络或appid与appkey");
enableLoginButton(true, false);
break;
case ClientSdkManager.IAcceptListener.STATUS_PLUGIN_CONNECT:
mStatusTextView.setText("插件连接成功");
Log.i(TAG, "extra : " + extra);
showTimer();
break;
case ClientSdkManager.IAcceptListener.STATUS_PLUGIN_DISCONNECT:
mStatusTextView.setText("插件连接断开, total times: " + totalTimes);
Log.i(TAG, "totol times: " + totalTimes);
hideTimer();
break;
case ClientSdkManager.IAcceptListener.ERROR_INVALID_ARG:
mStatusTextView.setText("无效的参数");
enableLoginButton(true, false);
break;
case ClientSdkManager.IAcceptListener.ERROR_INVALID_LICENSE:
mStatusTextView.setText("无效的授权");
enableLoginButton(true, false);
break;
case ClientSdkManager.IAcceptListener.ERROR_INVALID_PROTOCOL:
mStatusTextView.setText("无效的协议");
enableLoginButton(true, false);
break;
case ClientSdkManager.IAcceptListener.ERROR_INVALID_SERVERADDR:
mStatusTextView.setText("无效的地址");
enableLoginButton(true, false);
break;
case ClientSdkManager.IAcceptListener.ERROR_LICENSE_EXPIRE:
mStatusTextView.setText("授权已经过期");
enableLoginButton(true, false);
break;
case ClientSdkManager.IAcceptListener.ERROR_LOGIN_FAIL:
mStatusTextView.setText("登录失败");
enableLoginButton(true, false);
break;
case ClientSdkManager.IAcceptListener.ERROR_VERIFY_FAIL:
mStatusTextView.setText("appid/appkey验证失败");
enableLoginButton(true, false);
break;
default:
mStatusTextView.setText("未知错误,请确认网络或appid与appkey");
// error case, do nothing
enableLoginButton(true, false);
}
}
@Override
public void onNewfileArrived(int fileId) {
/* Log.i(TAG, "fileId : " + fileId);
FileTransferBean fileTransfer = ClientSdkManager.getInstance().getFileAttribute(fileId);
Log.i(TAG, "fileTransfer : " + fileTransfer.toString());*/
}
/**
*
*/
private void showTimer() {
findViewById(R.id.tv_timer).setVisibility(View.VISIBLE);
mCancel = false;
totalTimes = 0;
mHandler.sendEmptyMessageDelayed(WHAT_SHOW_TIMER, 1000);
}
/**
*
*/
private void hideTimer() {
findViewById(R.id.tv_timer).setVisibility(View.INVISIBLE);
mCancel = true;
}
private void enableLoginButton(boolean blogin, boolean blogout) {
mLoginButton.setEnabled(blogin);
mLogoutButton.setEnabled(blogout);
}
private void sendToast(String message) {
Message msg = mHandler.obtainMessage();
msg.what = WHAT_SHOW_TOAST;
msg.obj = message;
mHandler.sendMessage(msg);
}
public class CommonHandler extends Handler {
public CommonHandler(Looper looper) {
super(looper);
}
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case WHAT_SHOW_TIMER:
TextView tvTimer = findViewById(R.id.tv_timer);
if (null != tvTimer) {
tvTimer.setText(getString(R.string.connect_time) + (++totalTimes) + getString(R.string.miao));
}
if (!mCancel) {
sendEmptyMessageDelayed(WHAT_SHOW_TIMER, 1000);
}
break;
case WHAT_SHOW_STATUS:
TextView tvStatus = findViewById(R.id.tv_capture_status);
if (null != tvStatus) {
tvStatus.setText((CharSequence) msg.obj);
}
break;
case WHAT_SHOW_TOAST:
Toast.makeText(SobotHomeActivity.this, (CharSequence) msg.obj, Toast.LENGTH_SHORT).show();
break;
case WHAT_CREATE_SESSIONID:
createSession(PLUGIN_NAME_DESKTOP, mEditTextsessionid.getText().toString().trim());
break;
}
}
}
@Override
protected void onStart() {
super.onStart();
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);//返回最新的intent
String sessionid = getIntent().getStringExtra("sessionid");
mEditTextsessionid.setText(sessionid);
}
@Override
protected void onResume() {
super.onResume();
if (KnoxUtils.isSupportSamsungSdk() && KnoxUtils.checkApiLevel()) {
boolean isActive = KnoxUtils.isAdminActive(getApplication()) && KnoxUtils.isLicenseActive(getApplication());
mIsAllowKonx = isActive;
}
String sessionid = getIntent().getStringExtra("sessionId");
mEditTextsessionid.setText(sessionid);
}
@Override
protected void onDestroy() {
super.onDestroy();
// 在销毁时stopserver,并释放资源
ClientSdkManager.getInstance().stopCapture();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_HOME) {
moveTaskToBack(true);
return true;
} else if (keyCode == KeyEvent.KEYCODE_BACK) {
showExitDialog();
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public void onBackPressed() {
mCancel = true;
ClientSdkManager.getInstance().stopCapture();
ClientSdkManager.getInstance().restoreInputMethod();
handleLogout();
killSdkInputProcess((!mIsSystem && !mIsAllowKonx));
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.exit(0);
}
/**
* 启动参数
*
* @return
*/
private String getScreenArgs() {
return ARG_SCREEN_AGENT;
}
/**
* 启动参数
*
* @return
*/
private String getInputArgs() {
return ARG_INPUT_AGENT;
}
public void showExitDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.app_name)
.setMessage("是否退出应用")
.setPositiveButton("确定", (dialog, which) -> {
Toast.makeText(SobotHomeActivity.this, "点击了确定", Toast.LENGTH_SHORT).show();
System.exit(0);
})
.setNegativeButton("取消", null);
AlertDialog alertDialog = builder.create();
alertDialog.show();
}
}
package com.sobot.screencapturesdk.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.sobot.screencapturesdk.R;
public class SobotSplashActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
startActivity(new Intent(SobotSplashActivity.this, SobotHomeActivity.class));
finish();
}
}
\ No newline at end of file
package com.sobot.screencapturesdk.application;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import com.sobot.network.apiUtils.SobotBaseUrl;
import com.sobot.network.apiUtils.SobotHttpUtils;
import com.sobot.network.http.log.SobotNetLogUtils;
public class SobotApp extends Application{
private static Context mContext;
@Override
public void onCreate() {
super.onCreate();
mContext = this;
SobotBaseUrl.setApi_Host("http://test.sobot.com");
SobotHttpUtils.init(this);
SobotNetLogUtils.setShowDebug(true);
//外部app启动 事例代码
// Intent intent=new Intent();
// intent.setAction("com.sobot.cuptercontrol");
// intent.putExtra("sessionId","02a22b62828d4f62bfc16c61285bd547");
// startActivity(intent);
}
public static Context getAppContext(){
return mContext;
}
}
package com.sobot.screencapturesdk.factory;
import android.content.Context;
import android.graphics.Point;
import com.oray.sunlogin.interfaces.IDisplayInfo;
import com.sobot.screencapturesdk.utils.DisplayUtils;
public class DisplayInfoFactory implements IDisplayInfo {
private Context context;
public DisplayInfoFactory(Context context) {
this.context = context;
}
/**
* 用户指定截屏的大小,可以自行修改
* 获取屏幕分辨率大小
* @return
*/
@Override
public Point getDisplaySize() {
// return new Point(720, 1280);
return DisplayUtils.getDisplaySize(context);
}
/**
* 用户实际屏幕的分辨
* 获取屏幕分辨率
* @return 屏幕分辨率
*/
@Override
public Point getScreenSize() {
return DisplayUtils.getScreenSize(context);
}
/**
* 获取屏幕方向
* @return 0 / 90 / 180 / 270
*/
@Override
public int getDisplayRotation() {
return DisplayUtils.getDisplayRotation(context);
}
@Override
public int getOrientation() {
return DisplayUtils.getDisplayRotation(context);
}
}
package com.sobot.screencapturesdk.module;
import java.io.Serializable;
public class SobotResultItemModule implements Serializable {
private String p2pAddress;
private String license;
public String getP2pAddress() {
return p2pAddress;
}
public void setP2pAddress(String p2pAddress) {
this.p2pAddress = p2pAddress;
}
public String getLicense() {
return license;
}
public void setLicense(String license) {
this.license = license;
}
@Override
public String toString() {
return "SobotResultItemModule{" +
"p2pAddress='" + p2pAddress + '\'' +
", license='" + license + '\'' +
'}';
}
}
package com.sobot.screencapturesdk.module;
import java.io.Serializable;
public class SobotResultModule implements Serializable {
private String retCode;
private String retMsg;
private SobotResultItemModule item;
public String getRetCode() {
return retCode;
}
public void setRetCode(String retCode) {
this.retCode = retCode;
}
public String getRetMsg() {
return retMsg;
}
public void setRetMsg(String retMsg) {
this.retMsg = retMsg;
}
public SobotResultItemModule getItem() {
return item;
}
public void setItem(SobotResultItemModule item) {
this.item = item;
}
@Override
public String toString() {
return "SobotResultModule{" +
"retCode='" + retCode + '\'' +
", retMsg='" + retMsg + '\'' +
", item=" + item +
'}';
}
}
package com.sobot.screencapturesdk.utils;
import android.content.Context;
import android.graphics.Point;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.Surface;
import android.view.WindowManager;
import java.lang.reflect.Method;
/**
* Created by Neo on 2017/2/9.
*/
public class DisplayUtils {
/**
* 获取屏幕分辨率
* @param context
* @return Point. x: Width y :Height
*/
public static Point getDisplaySize(Context context) {
Point point = getScreenSize(context);
if (null == point)
return new Point(720, 1280);
int width = point.x;
int height = point.y;
boolean b6 = (width % 6 == 0) && (height % 6 == 0);
boolean b4 = (width % 4 == 0) && (height % 4 == 0);
int displayW = width, displayH = height;
//调整显示图像大小
int minSize = Math.min(width, height);
if (minSize >= 1400) {
if (b6) {
displayW = width / 3;
displayH = height / 3;
} else if (b4) {
displayW = width / 2;
displayH = height / 2;
}
} else if (minSize >= 1080) {
if (b4) {
displayW = width / 2;
displayH = height / 2;
}
}
return new Point(displayW, displayH);
}
/**
* 获取当前屏幕旋转角度
*
* @param context 上下文Context
* @return 0表示是竖屏; 90表示是左横屏; 180表示是反向竖屏; 270表示是右横屏
*/
public static int getDisplayRotation(Context context) {
if (context == null) return 0;
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
if (null == windowManager) return 0;
int rotation = windowManager.getDefaultDisplay().getRotation();
switch (rotation) {
case Surface.ROTATION_0:
return 0;
case Surface.ROTATION_90:
return 90;
case Surface.ROTATION_180:
return 180;
case Surface.ROTATION_270:
return 270;
}
return 0;
}
/**
* 获取屏幕分辨率
* @param context
* @return Point. x: Width y :Height
*/
public static Point getScreenSize(Context context) {
if (context == null) return null;
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
if (wm == null) return null;
Display display = wm.getDefaultDisplay();
DisplayMetrics dm = new DisplayMetrics();
Class c;
try {
c = Class.forName("android.view.Display");
Method method = c.getMethod("getRealMetrics", DisplayMetrics.class);
method.invoke(display, dm);
int width = dm.widthPixels;
int height = dm.heightPixels;
return new Point(width, height);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
\ No newline at end of file
package com.sobot.screencapturesdk.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
import com.sobot.screencapturesdk.R;
public class RoundProgressBar extends View {
private Paint mPaint;
/**
* 圆环的颜色
*/
private int roundColor;
/**
* 圆环进度的颜色
*/
private int roundProgressColor;
/**
* 圆环的宽度
*/
private float roundWidth;
/**
* 最大进度
*/
private long mMax;
/**
* 当前进度
*/
private long mProgress;
/**
* 进度的风格,实心或者空心
*/
private int style;
public static final int STROKE = 0;
public static final int FILL = 1;
private RectF mOval = new RectF();
private boolean mEnableProgress = false;
public RoundProgressBar(Context context) {
this(context, null);
}
public RoundProgressBar(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public RoundProgressBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mPaint = new Paint();
TypedArray mTypedArray = context.obtainStyledAttributes(attrs, R.styleable.RoundProgressBar);
// 获取自定义属性和默认值
roundColor = mTypedArray.getColor(R.styleable.RoundProgressBar_roundColor, Color.RED);
roundProgressColor = mTypedArray.getColor(R.styleable.RoundProgressBar_roundProgressColor, Color.RED);
roundWidth = mTypedArray.getDimension(R.styleable.RoundProgressBar_width, 5);
mMax = mTypedArray.getInteger(R.styleable.RoundProgressBar_max, 100);
mTypedArray.recycle();
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (!mEnableProgress) {
return;
}
// 准备画笔
mPaint.setColor(roundColor);
mPaint.setStrokeWidth(roundWidth);
mPaint.setAntiAlias(true);
// 绘制外层圆环
int centre = getWidth() / 2;
int radius = (int) (centre - roundWidth / 2);
// canvas.drawCircle(centre, centre, radius, mPaint);
// 画圆弧 ,画圆环的进度
mPaint.setColor(roundProgressColor);
mOval.set(centre - radius, centre - radius, centre + radius, centre + radius);
float progress = (float) mProgress / mMax;
switch (style) {
// LogUtils.i("STROKE>>> progress" + 360 * progress + "currentProgress>>>" + progress);
case STROKE:
mPaint.setStyle(Paint.Style.STROKE);
canvas.drawArc(mOval, -90, 360 * progress, false, mPaint); // 根据进度画圆弧
break;
case FILL:
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
if (mProgress != 0)
canvas.drawArc(mOval, -90, 360 * progress, true, mPaint); // 根据进度画圆弧
break;
}
}
public long getMax() {
return mMax;
}
/**
* 设置进度的最大值
*
* @param max
*/
public void setMax(long max) {
if (max < 0) {
throw new IllegalArgumentException("max not less than 0");
}
this.mMax = max;
}
/**
* 获取进度.需要同步
*
* @return 当前进度([0 - max])
*/
public long getProgress() {
return mProgress;
}
/**
* 设置进度, 进度应该为[0,max]
*
* @param progress
*/
public void setProgress(long progress) {
if (progress < 0) {
throw new IllegalArgumentException("progress not less than 0");
}
if (progress > mMax) {
progress = mMax;
invalidate();
} else {
this.mProgress = progress;
invalidate();
}
}
public int getRoundColor() {
return roundColor;
}
public void setRoundColor(int roundColor) {
this.roundColor = roundColor;
}
public int getRoundProgressColor() {
return roundProgressColor;
}
public void setRoundProgressColor(int roundProgressColor) {
this.roundProgressColor = roundProgressColor;
}
/**
* 设置是否绘制进度
*
* @param enable true 绘制进度
* @return always true.
*/
public boolean enableProgress(boolean enable) {
mEnableProgress = enable;
invalidate();
return true;
}
}
<?xml version="1.0" encoding="UTF-8"?><!--<layer-list xmlns:android="http://schemas.android.com/apk/res/android">--><!--&lt;!&ndash; 连框颜色值 &ndash;&gt;<item>--><!--<shape>--><!--<solid android:color="#ff0000" />--><!--</shape>--><!--</item>--><!--&lt;!&ndash; 主体背景颜色值 &ndash;&gt;--><!--<item android:bottom="3dp" android:right="3dp">--><!--<shape>--><!--<solid android:color="#ffffff" />-->
<!--<padding android:bottom="10dp"--><!--android:left="10dp"--><!--android:right="10dp"--><!--android:top="10dp" />--><!--</shape>--><!--</item>--><!--</layer-list>-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false">
<shape android:shape="rectangle">
<corners android:radius="4dp" />
<solid android:color="#dedede" />
<stroke android:width="1dp" android:color="#bfbfbf"></stroke>
<!--android:endColor="#ffebd8" android:startColor="#f5fcff"-->
<!--<gradient android:angle="270" />-->
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="4dp" />
<solid android:color="#fe7f05" />
<stroke android:width="1dp" android:color="#bfbfbf"></stroke>
<!--android:endColor="#ffebd8" android:startColor="#f5fcff"-->
<!--<gradient android:angle="270" />-->
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:radius="4dp" />
<solid android:color="#0f0" />
<stroke android:width="1dp" android:color="#bfbfbf"></stroke>
<!--android:endColor="#ece6e1" android:startColor="#fcfcfc"-->
<!--<gradient android:angle="270" />-->
</shape>
</item>
</selector>
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/aboutLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_timer"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:textSize="24sp" />
</LinearLayout>
<EditText
android:id="@+id/edit_sessionid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="340229f40dd34ad88e1c287d0b4b1f94"
android:hint="请输入sessionid" />
<TextView
android:id="@+id/tv_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="未连接" />
<TextView
android:id="@+id/tv_capture_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="" />
<Button
android:id="@+id/btn_login"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="5dp"
android:background="@drawable/button_style"
android:text="开始登录" />
<Button
android:id="@+id/btn_logout"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="15dp"
android:background="@drawable/button_style"
android:enabled="false"
android:text="注销当前登录" />
</LinearLayout>
</ScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.sobot.screencapturesdk.activity.SobotSplashActivity">
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="text_color_9A">#9A9A9A</color>
<color name="text_color_33">#333333</color>
<color name="bg_f5">#E9EEF5</color>
<color name="bg_line_E8">#E8EAEE</color>
<color name="white">#FFFFFFFF</color>
</resources>
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
<resources>
<string name="app_name">智齿远程控制SDK</string>
<string name="connect_time">已经连接</string>
<string name="miao"></string>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<declare-styleable name="RoundProgressBar">
<attr name="roundColor" format="color" />
<attr name="roundProgressColor" format="color" />
<attr name="width" format="dimension" />
<attr name="max" format="integer" />
<attr name="finishBackground" format="reference" />
<attr name="style">
<enum name="STROKE" value="0" />
<enum name="FILL" value="1" />
</attr>
</declare-styleable>
</resources>
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
<uses-policies>
</uses-policies>
</device-admin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<input-method xmlns:android="http://schemas.android.com/apk/res/android" >
</input-method>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<network-security-config >
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</base-config>
</network-security-config>
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Wed Apr 21 11:22:00 CST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
include ':app'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment