Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
obaby committed Oct 28, 2021
1 parent bf09599 commit 28ec979
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
<?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="cn.org.obaby.adsskiper">

<!-- Bugly 权限配置 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.READ_LOGS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.MANAGE_MEDIA_PROJECTION"/>
<uses-permission android:name="android.permission.MANAGE_MEDIA_PROJECTION"
tools:ignore="ProtectedPermissions" />

<!-- 息屏抢红包相关权限 -->
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<uses-permission android:name="android.permission.READ_FRAME_BUFFER"
tools:ignore="ProtectedPermissions" />



<application
android:name="LuckyMoneyTinkerApplication"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.GestureDescription;
import android.annotation.SuppressLint;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
Expand All @@ -11,6 +12,7 @@
import android.graphics.RectF;
import android.os.Build;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.accessibility.AccessibilityEvent;
import android.widget.Toast;
Expand All @@ -21,6 +23,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.LinkedList;
import java.util.List;

Expand Down Expand Up @@ -263,6 +266,44 @@ public static Bitmap screecap(int screenWidth, int screenHeight) {
return bitmap;
}

//https://www.jianshu.com/p/161486999de4
private Bitmap screenShotByReflect(){
Bitmap mScreenBitmap = null;
DisplayMetrics mDisplayMetrics = new DisplayMetrics();
float[] dims = { mDisplayMetrics.widthPixels,
mDisplayMetrics.heightPixels };
try {
Class<?> demo = Class.forName("android.view.SurfaceControl");
Method method = demo.getDeclaredMethod("screenshot", int.class,int.class);
mScreenBitmap = (Bitmap) method.invoke(null,(int) dims[0],(int) dims[1]);
} catch (Exception e) {
e.printStackTrace();
}
return mScreenBitmap;
}

// public Bitmap screenshot() {
// Resources resources = this.getResources();
// DisplayMetrics dm = resources.getDisplayMetrics();
//
// String surfaceClassName = "";
// if (Build.VERSION.SDK_INT <= 17) {
// surfaceClassName = "android.view.Surface";
// } else {
// surfaceClassName = "android.view.SurfaceControl";
// }
//
// try {
// Class<?> c = Class.forName(surfaceClassName);
// Method method = c.getMethod("screenshot", new Class[]{int.class, int.class});
// method.setAccessible(true);
// return (Bitmap) method.invoke(null, dm.widthPixels, dm.heightPixels);
// } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException | ClassNotFoundException e) {
// e.printStackTrace();
// }
// return null;
// }

/**
* 保存图片到本地缓存目录(调试时使用)
*
Expand Down

0 comments on commit 28ec979

Please sign in to comment.