Skip to content

V2 #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Sep 11, 2024
Merged

V2 #39

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:

steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- name: Build with Gradle
run: ./gradlew build
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
*.iml
.gradle
/local.properties
/.idea/caches/build_file_checksums.ser
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea
.DS_Store
/build
/captures
.externalNativeBuild
sign.jks
signing.properties
23 changes: 9 additions & 14 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'//kapt 插件
apply from: "${rootDir}/common.gradle"
android {
namespace "com.wrbug.developerhelper"
lintOptions {
checkReleaseBuilds false
abortOnError false
Expand All @@ -14,20 +14,16 @@ android {
releaseConfig
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 28
compileSdk 34
defaultConfig {
applicationId "com.wrbug.developerhelper"
minSdkVersion 21
targetSdkVersion 27
targetSdkVersion 34
versionCode 100040
versionName "1.0.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
abiFilters "arm64-v8a"
}
}
buildTypes {
Expand All @@ -45,32 +41,31 @@ android {
dataBinding {
enabled = true
}

}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.google.code.gson:gson:2.10'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.github.yhaolpz:FloatWindow:1.0.9'
implementation project(':basecommon')
kapt "com.android.databinding:compiler:3.1.4"
implementation 'com.elvishew:xlog:1.6.1'
implementation 'org.jetbrains.anko:anko-commons:0.10.8'
implementation 'com.airbnb.android:lottie:6.5.2'
//dagger2
implementation 'com.google.dagger:dagger:2.16'
// https://mvnrepository.com/artifact/dom4j/dom4j
implementation 'dom4j:dom4j:1.6.1'
implementation 'com.evrencoskun.library:tableview:0.8.8'
implementation 'gdut.bsx:share2:0.9.3'
kapt 'com.google.dagger:dagger-compiler:2.16'
implementation project(':xposedmodule')
implementation 'de.blox:graphview:0.5.0'
implementation project(':basemoduleimport')
implementation project(":commonwidget")
implementation project(':ipc')
}
kapt {
Expand Down
24 changes: 12 additions & 12 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?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.wrbug.developerhelper">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
Expand All @@ -20,11 +19,10 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".ui.activity.xposed.appxposedmodulemanager.AppXposedModuleManagerActivity"></activity>
<activity android:name=".ui.activity.xposed.appxposedsetting.AppXposedSettingActivity" />
<activity
android:name=".ui.activity.main.MainActivity"
android:launchMode="singleTop">
android:launchMode="singleTop"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -34,7 +32,8 @@

<service
android:name=".service.DeveloperHelperAccessibilityService"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
android:exported="false">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
Expand All @@ -56,10 +55,15 @@

<activity
android:name=".ui.activity.guide.GuideActivity"
android:exported="false"
android:label="@string/title_activity_guide"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".ui.activity.sharedpreferencesedit.SharedPreferenceEditActivity" />
<activity android:name=".ui.activity.databaseedit.DatabaseEditActivity" />
<activity
android:name=".ui.activity.sharedpreferencesedit.SharedPreferenceEditActivity"
android:exported="false" />
<activity
android:name=".ui.activity.databaseedit.DatabaseEditActivity"
android:exported="false" />

<provider
android:name="androidx.core.content.FileProvider"
Expand All @@ -70,10 +74,6 @@
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>

<activity android:name=".ui.activity.xposed.xposedsetting.XposedSettingActivity" />
<activity android:name=".ui.activity.xposed.shellmanager.ShellAppManagerActivity" />
<activity android:name=".ui.activity.xposed.datafindermanager.DataFinderManagerActivity" />
</application>

</manifest>
31 changes: 14 additions & 17 deletions app/src/main/java/com/wrbug/developerhelper/DeveloperApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.elvishew.xlog.LogConfiguration
import com.elvishew.xlog.LogLevel
import com.elvishew.xlog.XLog
import com.elvishew.xlog.internal.DefaultsFactory
import com.wrbug.datafinder.startup.LaunchContentProvider
import com.wrbug.developerhelper.basecommon.BaseApp
import com.wrbug.developerhelper.basewidgetimport.BaseModule
import com.wrbug.developerhelper.commonutil.ProcessUtil
Expand All @@ -19,33 +18,35 @@ import java.io.FileOutputStream
import com.wrbug.developerhelper.ipc.processshare.tcp.TcpManager
import com.wrbug.developerhelper.ipcserver.IpcManager
import com.wrbug.developerhelper.ui.activity.main.MainActivity
import com.wrbug.developerhelper.util.AppStatusRegister
import org.jetbrains.anko.doAsync


class DeveloperApplication : BaseApp() {
companion object {

private lateinit var instance: DeveloperApplication
fun getInstance(): DeveloperApplication {
return instance
}
}

override fun attachBaseContext(base: Context?) {
LaunchContentProvider.setAutoLaunch(false)
super.attachBaseContext(base)
instance = this
}

override fun onCreate() {
super.onCreate()
XLog.init(
LogConfiguration.Builder().logLevel(LogLevel.ALL).tag("developerHelper.print-->").build(),
LogConfiguration.Builder().logLevel(LogLevel.ALL).tag("developerHelper.print-->")
.build(),
DefaultsFactory.createPrinter()
)
registerIpcServer()
BaseModule.init(this)
releaseAssetsFile()
registerLifecycle()
AppStatusRegister.init(this)
}

private fun registerIpcServer() {
Expand All @@ -61,40 +62,36 @@ class DeveloperApplication : BaseApp() {
private fun registerLifecycle() {
registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
private var count = 0
override fun onActivityPaused(activity: Activity?) {
override fun onActivityPaused(activity: Activity) {

}

override fun onActivityResumed(activity: Activity?) {
override fun onActivityResumed(activity: Activity) {
}

override fun onActivityStarted(activity: Activity?) {
override fun onActivityStarted(activity: Activity) {
count++
}

override fun onActivityDestroyed(activity: Activity?) {
override fun onActivityDestroyed(activity: Activity) {
}

override fun onActivitySaveInstanceState(activity: Activity?, outState: Bundle?) {
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
}

override fun onActivityStopped(activity: Activity?) {
override fun onActivityStopped(activity: Activity) {
count--
activity?.let {
if (count == 0 && activity is MainActivity) {
activity.finish()
}
if (count == 0 && activity is MainActivity) {
activity.finish()
}

}

override fun onActivityCreated(activity: Activity?, savedInstanceState: Bundle?) {
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
}

})
}


private fun releaseAssetsFile() {
doAsync {
val inputStream = BaseApp.instance.assets.open("zip.dex")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,22 @@ import com.wrbug.developerhelper.R
import com.wrbug.developerhelper.basecommon.showToast
import com.wrbug.developerhelper.commonutil.shell.Callback
import com.wrbug.developerhelper.commonutil.shell.ShellManager
import com.wrbug.developerhelper.util.getString
import io.reactivex.rxjava3.core.Single

object AccessibilityManager {
fun startService(context: Context?, callback: Callback<Boolean>? = null) {
context?.run {
ShellManager.openAccessibilityService(object : Callback<Boolean> {
override fun onSuccess(data: Boolean) {
if (!data) {
showToast(getString(R.string.please_open_accessbility_service))
startAccessibilitySetting(context)
}
callback?.onSuccess(data)
}

override fun onFailed(msg: String) {
callback?.onFailed(msg)
startAccessibilitySetting(context)
}

})
fun startService(context: Context?): Single<Boolean> {
return ShellManager.openAccessibilityService().doOnSuccess {
if (!it) {
context?.showToast(getString(R.string.please_open_accessbility_service))
startAccessibilitySetting(context)
}
}
}

fun startAccessibilitySetting(context: Context) {

fun startAccessibilitySetting(context: Context?) {
context ?: return
val intent = Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(intent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class DeveloperHelperAccessibilityService : AccessibilityService() {
BaseApp.instance.applicationContext.contentResolver,
android.provider.Settings.Secure.ACCESSIBILITY_ENABLED
)
} catch (e: Settings.SettingNotFoundException) {
} catch (_: Settings.SettingNotFoundException) {
}

val mStringColonSplitter = TextUtils.SimpleStringSplitter(':')
Expand Down Expand Up @@ -113,7 +113,6 @@ class DeveloperHelperAccessibilityService : AccessibilityService() {
}



override fun onDestroy() {
super.onDestroy()
nodeMap.clear()
Expand Down Expand Up @@ -206,16 +205,8 @@ class DeveloperHelperAccessibilityService : AccessibilityService() {

inner class DeveloperHelperAccessibilityReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, data: Intent?) {
showToast(getString(R.string.getting_app_info))
ShellManager.getTopActivity(object : Callback<TopActivityInfo?> {

override fun onSuccess(data: TopActivityInfo?) {
topActivity = data
val nodesInfo = readNode()
HierarchyActivity.start(context, currentAppInfo, nodesInfo, topActivity)
}
})

val nodesInfo = readNode()
HierarchyActivity.start(context, currentAppInfo, nodesInfo)
}
}

Expand Down
Loading
Loading