2021.04.08

This commit is contained in:
FHT
2021-04-08 11:22:29 +08:00
parent bea9f1c45c
commit a76ee8f972
11 changed files with 248 additions and 88 deletions

View File

@@ -14,8 +14,9 @@ class MainActivity : AppCompatActivity(), CancelAdapt {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
//截图
CmdUtil.execute(" screencap -p /sdcard/" + "screen" + System.currentTimeMillis() + ".png")
// CmdUtil.execute(" screencap -p /sdcard/" + "screen" + System.currentTimeMillis() + ".png")
textView.setText(DevicesUtils.getSerial())
}

View File

@@ -0,0 +1,42 @@
package com.tt.activity;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import com.tt.receiver.PackageReceiver;
import com.tt.ttutils.R;
public class PackageActivity extends AppCompatActivity {
private PackageReceiver packageReceiver;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_package);
register();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (null != packageReceiver) {
unregisterReceiver(packageReceiver);
}
}
private void register() {
if (null == packageReceiver) {
packageReceiver = new PackageReceiver();
}
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
filter.addDataScheme("package");
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
registerReceiver(packageReceiver, filter);
}
}

View File

@@ -0,0 +1,21 @@
package com.tt.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// TODO: This method is called when the BroadcastReceiver is receiving
// an Intent broadcast.
//throw new UnsupportedOperationException("Not yet implemented");
String action = intent.getAction();
if (action.equals(Intent.ACTION_BOOT_COMPLETED)) {
//自启
} else if (action.equals(Intent.ACTION_USER_PRESENT)) {
//解锁
}
}
}

View File

@@ -0,0 +1,21 @@
package com.tt.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class PackageReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// TODO: This method is called when the BroadcastReceiver is receiving
// an Intent broadcast.
//throw new UnsupportedOperationException("Not yet implemented");
String action = intent.getAction();
if (action.equals(Intent.ACTION_PACKAGE_ADDED)
|| action.equals(Intent.ACTION_PACKAGE_REPLACED)
|| action.equals(Intent.ACTION_PACKAGE_REMOVED)) {
}
}
}

View File

@@ -0,0 +1,10 @@
package com.tt.ttutils.jni;
public class NDKTools {
static {
System.loadLibrary("myMeetJni");
}
public static native String getStringFromNDK();
}

View File

@@ -0,0 +1,21 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_tt_ttutils_jni_NDKTools */
#ifndef _Included_com_tt_ttutils_jni_NDKTools
#define _Included_com_tt_ttutils_jni_NDKTools
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_tt_ttutils_jni_NDKTools
* Method: getStringFromNDK
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_tt_ttutils_jni_NDKTools_getStringFromNDK
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif