2021.04.08
This commit is contained in:
@@ -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())
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
42
app/src/main/java/com/tt/activity/PackageActivity.java
Normal file
42
app/src/main/java/com/tt/activity/PackageActivity.java
Normal 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);
|
||||
}
|
||||
}
|
||||
21
app/src/main/java/com/tt/receiver/BootReceiver.java
Normal file
21
app/src/main/java/com/tt/receiver/BootReceiver.java
Normal 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)) {
|
||||
//解锁
|
||||
}
|
||||
}
|
||||
}
|
||||
21
app/src/main/java/com/tt/receiver/PackageReceiver.java
Normal file
21
app/src/main/java/com/tt/receiver/PackageReceiver.java
Normal 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)) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
10
app/src/main/java/com/tt/ttutils/jni/NDKTools.java
Normal file
10
app/src/main/java/com/tt/ttutils/jni/NDKTools.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.tt.ttutils.jni;
|
||||
|
||||
public class NDKTools {
|
||||
static {
|
||||
System.loadLibrary("myMeetJni");
|
||||
}
|
||||
|
||||
public static native String getStringFromNDK();
|
||||
|
||||
}
|
||||
21
app/src/main/java/com_tt_ttutils_jni_NDKTools.h
Normal file
21
app/src/main/java/com_tt_ttutils_jni_NDKTools.h
Normal 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
|
||||
Reference in New Issue
Block a user