diff --git a/app/build.gradle b/app/build.gradle index 5224de8..946b539 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,11 +1,28 @@ apply plugin: 'com.android.application' -static def appName() { - return "小酷守护" +static String getBuildConfigFieldValue(def variant, def fiedName) { + def properties = variant.productFlavors[0].properties + def name = properties.get("name") + if (name != variant.flavorName) { + return "" + } + def configs = properties.get("buildConfigFields") + def address = null + for (Map.Entry item : configs) { + def key = item.key + if (key == fiedName) { + address = item.value + } + } + if (address == null) return "" + def field = address.getClass().getDeclaredField("value") + field.setAccessible(true) + return field.get(address).toString().replace("\"", "") } + static def releaseTime() { - return new Date().format("yyyyMMdd-HHmmss", TimeZone.getDefault()) + return new Date().format("yyyyMMdd_HHmmss", TimeZone.getDefault()) } android { @@ -13,11 +30,9 @@ android { buildToolsVersion "29.0.3" defaultConfig { - applicationId "com.uiuipad.find" minSdkVersion 24 targetSdkVersion 29 - versionCode 19 - versionName "1.1.8" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -46,6 +61,57 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } + //多版本 + productFlavors { + kuxin { + flavorDimensions "default" + applicationId "com.uiuipad.find" + versionCode 27 + versionName "1.2.6" + buildConfigField "String", "app_name", '"小酷守护"' + manifestPlaceholders = [ + ALIPUSH_KEY : "333898263", + ALIPUSH_SECRET: "e1b374229ffe479eb34ba74432b7e454", + ] + } + + aiKuxin { + flavorDimensions "default" + applicationId "com.aole.safe" + versionCode 1 + versionName "1.0.0" + buildConfigField "String", "app_name", '"守护中心"' + manifestPlaceholders = [ + ALIPUSH_KEY : "333982424", + ALIPUSH_SECRET: "c831992e2de743dcad66f5ec420798a4", + ] + } + + aigo { + flavorDimensions "default" + applicationId "com.safeos.ae" + versionCode 1 + versionName "1.0.0" + buildConfigField "String", "app_name", '"安全守护"' + manifestPlaceholders = [ + ALIPUSH_KEY : "333982410", + ALIPUSH_SECRET: "6d8785a73d904055ac00f84d83400be4", + ] + } + + phone { + flavorDimensions "default" + applicationId "com.dangsafe.kf" + versionCode 1 + versionName "1.0.0" + buildConfigField "String", "app_name", '"时间守护"' + manifestPlaceholders = [ + ALIPUSH_KEY : "333982833", + ALIPUSH_SECRET: "67a5bf10515947459c04fc000367feca", + ] + } + } + //签名 signingConfigs { //iPlay50 mini,iPlay50 android13 共用签名 @@ -81,43 +147,173 @@ android { keyPassword "123456" v2SigningEnabled false } + + G10P { + storeFile file("keystore/G10PMTK11.jks") + storePassword "123456" + keyAlias "G10PMTK11" + keyPassword "123456" + v1SigningEnabled true + v2SigningEnabled true + } + + teclast8183 { + storeFile file("keystore/TeclastMTK12.jks") + storePassword "123456" + keyAlias "TeclastMTK12" + keyPassword "123456" + v2SigningEnabled false + } + + UnisocS6688 { + storeFile file("keystore/UnisocS6688Userdebug.jks") + storePassword "123456" + keyAlias "unisocs6688userdebug" + keyPassword "123456" + v1SigningEnabled true + v2SigningEnabled true + } + + Aigo1071 { + storeFile file("keystore/Aigo1071.jks") + storePassword "123456" + keyAlias "aigo1071" + keyPassword "123456" + v1SigningEnabled true + v2SigningEnabled true + } } buildTypes { + Aigo1071Debug.initWith(debug) + Aigo1071Debug { + versionNameSuffix "-debug" + debuggable true + signingConfig signingConfigs.Aigo1071 + buildConfigField "String", "platform", '"W8183"' + manifestPlaceholders = [ + Baidu_AK: "YCmfZSw54O992lChzS3c4roYioitT54h" + ] + } + + Aigo1071Release.initWith(release) + Aigo1071Release { + signingConfig signingConfigs.Aigo1071 + buildConfigField "String", "platform", '"W8183"' + manifestPlaceholders = [ + Baidu_AK: "YCmfZSw54O992lChzS3c4roYioitT54h" + ] + } + + UnisocS6688Debug.initWith(debug) + UnisocS6688Debug { + versionNameSuffix "-debug" + debuggable true + signingConfig signingConfigs.UnisocS6688 + buildConfigField "String", "platform", '"S6688"' + manifestPlaceholders = [ + Baidu_AK: "YCmfZSw54O992lChzS3c4roYioitT54h" + ] + } + + UnisocS6688Release.initWith(release) + UnisocS6688Release { + signingConfig signingConfigs.UnisocS6688 + buildConfigField "String", "platform", '"S6688"' + manifestPlaceholders = [ + Baidu_AK: "YCmfZSw54O992lChzS3c4roYioitT54h" + ] + } + + teclast8183Debug.initWith(debug) + teclast8183Debug { + versionNameSuffix "-debug" + debuggable true + signingConfig signingConfigs.teclast8183 + buildConfigField "String", "platform", '"A11MTK8183"' + manifestPlaceholders = [ + Baidu_AK: "YCmfZSw54O992lChzS3c4roYioitT54h" + ] + } + + teclast8183Release.initWith(release) + teclast8183Release { + signingConfig signingConfigs.teclast8183 + buildConfigField "String", "platform", '"A11MTK8183"' + manifestPlaceholders = [ + Baidu_AK: "YCmfZSw54O992lChzS3c4roYioitT54h" + ] + } + + G10PDebug.initWith(debug) + G10PDebug { + versionNameSuffix "-debug" + debuggable true + signingConfig signingConfigs.G10P + buildConfigField "String", "platform", '"G10P"' + manifestPlaceholders = [ + Baidu_AK: "YCmfZSw54O992lChzS3c4roYioitT54h" + ] + } + + G10PRelease.initWith(release) + G10PRelease { + signingConfig signingConfigs.G10P + buildConfigField "String", "platform", '"G10P"' + manifestPlaceholders = [ + Baidu_AK: "YCmfZSw54O992lChzS3c4roYioitT54h" + ] + } + U807UserDebug.initWith(release) U807UserDebug { - buildConfigField "String", "platform", '"U807"' // versionNameSuffix "-debug" // debuggable true signingConfig signingConfigs.U807UserDebug + buildConfigField "String", "platform", '"U807"' + manifestPlaceholders = [ + Baidu_AK: "yhlCxeBmZ1I7ZO50Emw4ptPtcYGOFg59" + ] } U807Debug.initWith(debug) U807Debug { - buildConfigField "String", "platform", '"U807"' versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.U807 + buildConfigField "String", "platform", '"U807"' + manifestPlaceholders = [ + Baidu_AK: "yhlCxeBmZ1I7ZO50Emw4ptPtcYGOFg59" + ] } U807Release.initWith(release) U807Release { - buildConfigField "String", "platform", '"U807"' signingConfig signingConfigs.U807 + buildConfigField "String", "platform", '"U807"' + manifestPlaceholders = [ + Baidu_AK: "yhlCxeBmZ1I7ZO50Emw4ptPtcYGOFg59" + ] } iPlay50SEDebug.initWith(debug) iPlay50SEDebug { - buildConfigField "String", "platform", '"iPaly50SE"' versionNameSuffix "-debug" debuggable true signingConfig signingConfigs.iPlay50SE + buildConfigField "String", "platform", '"MTK8183"' + manifestPlaceholders = [ + Baidu_AK: "yhlCxeBmZ1I7ZO50Emw4ptPtcYGOFg59" + ] } iPlay50SERelease.initWith(release) iPlay50SERelease { - buildConfigField "String", "platform", '"iPaly50SE"' signingConfig signingConfigs.iPlay50SE + buildConfigField "String", "platform", '"MTK8183"' + manifestPlaceholders = [ + Baidu_AK: "yhlCxeBmZ1I7ZO50Emw4ptPtcYGOFg59" + ] } debug { @@ -127,10 +323,14 @@ android { zipAlignEnabled true minifyEnabled false signingConfig signingConfigs.iPlay50mini + buildConfigField "String", "platform", '"iPlay50mini"' + manifestPlaceholders = [ + Baidu_AK: "YCmfZSw54O992lChzS3c4roYioitT54h" + ] applicationVariants.all { variant -> variant.outputs.each { output -> if (outputFile != null) { - def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk" + def fileName = "${getBuildConfigFieldValue(variant, "app_name")}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk" output.outputFileName = fileName } } @@ -146,18 +346,46 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' //签名 signingConfig signingConfigs.iPlay50mini + buildConfigField "String", "platform", '"iPlay50mini"' + manifestPlaceholders = [ + Baidu_AK: "YCmfZSw54O992lChzS3c4roYioitT54h" + ] // 将release版本的包名重命名,加上版本及日期 applicationVariants.all { variant -> variant.outputs.each { output -> def outputFile = "" if (outputFile != null) { - def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk" + def fileName = "${getBuildConfigFieldValue(variant, "app_name")}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk" output.outputFileName = new File(outputFile, fileName) } } } } } + + sourceSets { + kuxin { + res { + srcDirs 'src/res' + } + } + aiKuxin { + res { + srcDirs 'src/aiKuxin/res' + } + } + aigo { + res { + srcDirs 'src/aigo/res' + } + } + phone { + res { + srcDirs 'src/phone/res' + } + } + } + externalNativeBuild { cmake { path file('CMakeLists.txt') diff --git a/app/keystore/Aigo1071.jks b/app/keystore/Aigo1071.jks new file mode 100644 index 0000000..c32bd7a Binary files /dev/null and b/app/keystore/Aigo1071.jks differ diff --git a/app/keystore/G10PMTK11.jks b/app/keystore/G10PMTK11.jks new file mode 100644 index 0000000..324fa31 Binary files /dev/null and b/app/keystore/G10PMTK11.jks differ diff --git a/app/keystore/TeclastMTK12.jks b/app/keystore/TeclastMTK12.jks new file mode 100644 index 0000000..669cfa9 Binary files /dev/null and b/app/keystore/TeclastMTK12.jks differ diff --git a/app/keystore/UnisocS6688Userdebug.jks b/app/keystore/UnisocS6688Userdebug.jks new file mode 100644 index 0000000..07f2a13 Binary files /dev/null and b/app/keystore/UnisocS6688Userdebug.jks differ diff --git a/app/src/aiKuxin/res/values/strings.xml b/app/src/aiKuxin/res/values/strings.xml new file mode 100644 index 0000000..b947cbc --- /dev/null +++ b/app/src/aiKuxin/res/values/strings.xml @@ -0,0 +1,3 @@ + + 守护中心 + diff --git a/app/src/aigo/res/values/strings.xml b/app/src/aigo/res/values/strings.xml new file mode 100644 index 0000000..7fee0a8 --- /dev/null +++ b/app/src/aigo/res/values/strings.xml @@ -0,0 +1,3 @@ + + 安全守护 + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 55e401d..944014d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -85,7 +85,11 @@ android:name=".activity.AudioActivity" android:launchMode="singleTask" android:theme="@style/activity_styles" /> - + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + android:value="${ALIPUSH_KEY}" /> + android:value="${ALIPUSH_SECRET}" /> + android:value="${Baidu_AK}" /> diff --git a/app/src/main/java/com/uiuipad/find/activity/NoticeActivity.java b/app/src/main/java/com/uiuipad/find/activity/NoticeActivity.java new file mode 100644 index 0000000..fa39ad7 --- /dev/null +++ b/app/src/main/java/com/uiuipad/find/activity/NoticeActivity.java @@ -0,0 +1,105 @@ +package com.uiuipad.find.activity; + +import android.content.Context; +import android.content.Intent; +import android.media.AudioManager; +import android.media.MediaPlayer; +import android.net.Uri; +import android.os.Bundle; +import android.os.PowerManager; +import android.os.Vibrator; +import android.view.View; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; + +import com.uiuipad.find.R; +import com.uiuipad.find.util.ApkUtils; +import com.uiuipad.find.util.WakeUpUtils; + +import java.io.IOException; + +import butterknife.BindView; +import butterknife.ButterKnife; + +public class NoticeActivity extends AppCompatActivity { + private String TAG = NoticeActivity.class.getSimpleName(); + + @BindView(R.id.positive) + TextView positive; + + private int mId; + private MediaPlayer mMediaPlayer; + private PowerManager mPowerManager; + private PowerManager.WakeLock mWakeLock; + private AudioManager mAudioManager; + + private Vibrator mVibrator; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_notice); + ButterKnife.bind(this); + + Intent intent = getIntent(); + mId = intent.getIntExtra("id", -1); + + mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); + mWakeLock = mPowerManager.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_DIM_WAKE_LOCK, "WakeAndLock"); + mVibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); + mWakeLock.acquire(60 * 1000L); + long[] pattern = {1000, 5000, 1000, 5000}; + mVibrator.vibrate(pattern, 0); + WakeUpUtils.wakeUpAndUnlockScreen(this); + + mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); + int maxVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_ALARM); + mAudioManager.setStreamVolume(AudioManager.STREAM_ALARM, maxVolume, AudioManager.FLAG_PLAY_SOUND); +// mMediaPlayer.setAudioAttributes(new AudioAttributes.Builder().setContentType(AudioAttributes.USAGE_ALARM).build()); + Uri uri = Uri.parse("android.resource://com.uiui.aios/raw/new_alarm_clock"); + mMediaPlayer = new MediaPlayer(); + try { + mMediaPlayer.setDataSource(getApplicationContext(), uri); + mMediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM); + mMediaPlayer.prepare(); + } catch (IOException e) { + e.printStackTrace(); + } + mMediaPlayer.setLooping(true); + // 开始播放 +// mMediaPlayer.start(); + + positive.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + ApkUtils.openPackage(NoticeActivity.this,"com.uiuipad.zyinfo","com.uiuipad.zyinfo.activity.main.MainActivity"); + mVibrator.cancel(); + finish(); + } + }); + } + + + @Override + protected void onDestroy() { + super.onDestroy(); + if (mMediaPlayer != null) { + if (mMediaPlayer.isPlaying()) { + mMediaPlayer.stop(); + } + mMediaPlayer.release(); + mMediaPlayer = null; + } + } + + @Override + public void onBackPressed() { + super.onBackPressed(); + } + + @Override + protected void onPause() { + super.onPause(); + } +} diff --git a/app/src/main/java/com/uiuipad/find/activity/main/MainAPresenter.java b/app/src/main/java/com/uiuipad/find/activity/main/MainAPresenter.java index 889053b..952b0a9 100644 --- a/app/src/main/java/com/uiuipad/find/activity/main/MainAPresenter.java +++ b/app/src/main/java/com/uiuipad/find/activity/main/MainAPresenter.java @@ -12,6 +12,7 @@ import com.uiuipad.find.comm.CommonConfig; import com.uiuipad.find.network.NetInterfaceManager; import com.uiuipad.find.util.BitmapUtils; import com.uiuipad.find.util.CXAESUtil; +import com.uiuipad.find.util.ControlUtils; import com.uiuipad.find.util.Utils; import io.reactivex.rxjava3.annotations.NonNull; @@ -81,6 +82,7 @@ public class MainAPresenter implements MainAContact.Presenter { mView.setSnInfoNotFound(); } else if (code == 403) { mView.setSnInfoNoBind(); + ControlUtils.disableSystemControl(mContext); } } diff --git a/app/src/main/java/com/uiuipad/find/activity/main/MainActivity.java b/app/src/main/java/com/uiuipad/find/activity/main/MainActivity.java index feac99f..0c161d6 100644 --- a/app/src/main/java/com/uiuipad/find/activity/main/MainActivity.java +++ b/app/src/main/java/com/uiuipad/find/activity/main/MainActivity.java @@ -179,6 +179,12 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView, mPresenter.getQrCode(); } + @Override + protected void onDestroy() { + super.onDestroy(); + mPresenter.detachView(); + } + @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == KeyEvent.ACTION_DOWN) { diff --git a/app/src/main/java/com/uiuipad/find/hook/KuxinActivityController.java b/app/src/main/java/com/uiuipad/find/hook/KuxinActivityController.java new file mode 100644 index 0000000..f07605e --- /dev/null +++ b/app/src/main/java/com/uiuipad/find/hook/KuxinActivityController.java @@ -0,0 +1,47 @@ +package com.uiuipad.find.hook; + +import android.app.IActivityController; +import android.content.Intent; +import android.util.Log; + +public class KuxinActivityController extends IActivityController.Stub { + private static final String TAG = KuxinActivityController.class.getSimpleName(); + + @Override + public boolean activityStarting(Intent intent, String pkg) { + Log.e(TAG, "activityStarting: " + pkg + ", intent= " + intent); + //retrun false;//false 则不会启动,直接返回。 + return true; + } + + @Override + public boolean activityResuming(String pkg) { + Log.e(TAG, "activityResuming: " + pkg); + return true; + } + + @Override + public int appEarlyNotResponding(String processName, int pid, String annotation) { + Log.e(TAG, "appEarlyNotResponding: " + processName); + return 0; + } + + @Override + public boolean appCrashed(String processName, int pid, String shortMsg, String longMsg, long timeMillis, String stackTrace) { + Log.e(TAG, "appCrashed: " + processName); + return false; + } + + @Override + public int appNotResponding(String processName, int pid, String processStats) { + Log.e(TAG, "appNotResponding: " + processName); + return 0; + } + + @Override + public int systemNotResponding(String msg) { + Log.e(TAG, "systemNotResponding: " + msg); + return 1; + } +} + diff --git a/app/src/main/java/com/uiuipad/find/network/NetInterfaceManager.java b/app/src/main/java/com/uiuipad/find/network/NetInterfaceManager.java index 6c1542d..7878672 100644 --- a/app/src/main/java/com/uiuipad/find/network/NetInterfaceManager.java +++ b/app/src/main/java/com/uiuipad/find/network/NetInterfaceManager.java @@ -198,7 +198,7 @@ public class NetInterfaceManager { } mUploadIconPkgs = mMMKV.decodeStringSet(uploadIconPkgsKey, new HashSet<>()); - Log.e("init", "NetInterfaceManager: mUploadIconPkgs = "+mUploadIconPkgs ); + Log.e("init", "NetInterfaceManager: mUploadIconPkgs = " + mUploadIconPkgs); } private String getCacheDir() { @@ -282,25 +282,25 @@ public class NetInterfaceManager { public Observable getUpdateSnInfoControl() { Map params = new HashMap<>(); - params.put("wifi_name", NetInterfaceManager.convertToRequestBody(Utils.getWifiSsid(mContext))); - params.put("wifi_signal", NetInterfaceManager.convertToRequestBody(Utils.getWifiRssi(mContext))); - params.put("battery", NetInterfaceManager.convertToRequestBody(Utils.getBattery(mContext))); - params.put("bluetooth", NetInterfaceManager.convertToRequestBody(Utils.getBluetoothList())); - params.put("memory", NetInterfaceManager.convertToRequestBody(Utils.getUsedMemoryString(mContext))); - params.put("storage", NetInterfaceManager.convertToRequestBody(Utils.getDataTotalSize(mContext))); - params.put("memory_use", NetInterfaceManager.convertToRequestBody(Utils.getUsedMemoryString(mContext))); - params.put("storage_use", NetInterfaceManager.convertToRequestBody(Utils.getUsedSize(mContext))); - params.put("sn", NetInterfaceManager.convertToRequestBody(Utils.getSerial())); - params.put("xiaoku_version", NetInterfaceManager.convertToRequestBody(BuildConfig.VERSION_NAME)); - params.put("xiaoku_version_time", NetInterfaceManager.convertToRequestBody(ApkUtils.getAppLastUpdateTime(mContext, BuildConfig.APPLICATION_ID))); - params.put("desktop_version", NetInterfaceManager.convertToRequestBody(ApkUtils.getAPPVersionName(mContext, "com.uiuipad.os"))); - params.put("desktop_version_time", NetInterfaceManager.convertToRequestBody(ApkUtils.getAppLastUpdateTime(mContext, "com.uiuipad.os"))); - params.put("browser_version", NetInterfaceManager.convertToRequestBody(ApkUtils.getAPPVersionName(mContext, "com.uiuipad.browser"))); - params.put("browser_version_time", NetInterfaceManager.convertToRequestBody(ApkUtils.getAppLastUpdateTime(mContext, "com.uiuipad.browser"))); - params.put("imei", NetInterfaceManager.convertToRequestBody(Utils.getIMEI(mContext))); - params.put("model", NetInterfaceManager.convertToRequestBody(Build.MODEL)); - params.put("system", NetInterfaceManager.convertToRequestBody(Build.VERSION.RELEASE)); - params.put("rom", NetInterfaceManager.convertToRequestBody(Utils.getCustomVersion())); + params.put("wifi_name", convertToRequestBody(Utils.getWifiSsid(mContext))); + params.put("wifi_signal", convertToRequestBody(Utils.getWifiRssi(mContext))); + params.put("battery", convertToRequestBody(Utils.getBattery(mContext))); + params.put("bluetooth", convertToRequestBody(Utils.getBluetoothList())); + params.put("memory", convertToRequestBody(Utils.getUsedMemoryString(mContext))); + params.put("storage", convertToRequestBody(Utils.getDataTotalSize(mContext))); + params.put("memory_use", convertToRequestBody(Utils.getUsedMemoryString(mContext))); + params.put("storage_use", convertToRequestBody(Utils.getUsedSize(mContext))); + params.put("sn", convertToRequestBody(Utils.getSerial())); + params.put("xiaoku_version", convertToRequestBody(BuildConfig.VERSION_NAME)); + params.put("xiaoku_version_time", convertToRequestBody(ApkUtils.getAppLastUpdateTime(mContext, BuildConfig.APPLICATION_ID))); + params.put("desktop_version", convertToRequestBody(ApkUtils.getAPPVersionName(mContext, "com.uiuipad.os"))); + params.put("desktop_version_time", convertToRequestBody(ApkUtils.getAppLastUpdateTime(mContext, "com.uiuipad.os"))); + params.put("browser_version", convertToRequestBody(ApkUtils.getAPPVersionName(mContext, "com.uiuipad.browser"))); + params.put("browser_version_time", convertToRequestBody(ApkUtils.getAppLastUpdateTime(mContext, "com.uiuipad.browser"))); + params.put("imei", convertToRequestBody(Utils.getIMEI(mContext))); + params.put("model", convertToRequestBody(Build.MODEL)); + params.put("system", convertToRequestBody(Build.VERSION.RELEASE)); + params.put("rom", convertToRequestBody(Utils.getCustomVersion())); return mRetrofit.create(UpdateSnInfoApi.class) .updateSnInfo(params) @@ -510,7 +510,7 @@ public class NetInterfaceManager { public void updateAppInstall() { String jsonString = ApkUtils.getInstallAppInfo(mContext); - NetInterfaceManager.getInstance().getUpdateAppInstallControl(jsonString) + getInstance().getUpdateAppInstallControl(jsonString) .subscribe(new Observer() { @Override public void onSubscribe(@NonNull Disposable d) { @@ -569,7 +569,7 @@ public class NetInterfaceManager { //设置一个file文件 MultipartBody.Part body = MultipartBody.Part.createFormData("file", file.getName(), fileBody); Map params = new HashMap<>(); - params.put("package", NetInterfaceManager.convertToRequestBody(packageInfo.packageName)); + params.put("package", convertToRequestBody(packageInfo.packageName)); Call call = getUploadAppImgApi().uploadAppImg(params, body); call.enqueue(new RetryCallback(call, 1, 30 * 1000) { @Override diff --git a/app/src/main/java/com/uiuipad/find/push/PushManager.java b/app/src/main/java/com/uiuipad/find/push/PushManager.java index 23eeb06..1138c98 100644 --- a/app/src/main/java/com/uiuipad/find/push/PushManager.java +++ b/app/src/main/java/com/uiuipad/find/push/PushManager.java @@ -4,8 +4,11 @@ import android.annotation.SuppressLint; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.os.Build; import android.os.Handler; import android.os.PowerManager; import android.provider.Settings; @@ -17,10 +20,12 @@ import com.baidu.location.BDAbstractLocationListener; import com.baidu.location.BDLocation; import com.baidu.location.LocationClient; import com.google.gson.Gson; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.reflect.TypeToken; import com.tencent.mmkv.MMKV; import com.uiuipad.find.activity.AudioActivity; +import com.uiuipad.find.activity.NoticeActivity; import com.uiuipad.find.bean.kuxin.AppInfo; import com.uiuipad.find.bean.kuxin.BaseResponse; import com.uiuipad.find.bean.kuxin.SnSetting; @@ -33,9 +38,11 @@ import com.uiuipad.find.network.RetryCallback; import com.uiuipad.find.service.ManagerService; import com.uiuipad.find.service.main.MainService; import com.uiuipad.find.util.ApkUtils; +import com.uiuipad.find.util.CacheUtils; import com.uiuipad.find.util.Camera2BackgroundUtil; import com.uiuipad.find.util.CmdUtil; import com.uiuipad.find.util.ControlUtils; +import com.uiuipad.find.util.FileUtils; import com.uiuipad.find.util.TimeUtils; import com.uiuipad.find.util.ToastUtil; import com.uiuipad.find.util.Utils; @@ -136,6 +143,8 @@ public class PushManager { private static final String FORCE_STOP_APP = "32"; /*恢复出厂*/ private static final String RESTORE_FACTORY = "33"; + /*作业提醒*/ + private static final String HOMEWORK_NOTIFY = "34"; private PushManager(Context context) { @@ -227,11 +236,13 @@ public class PushManager { case BROWSER_CONTROL: break; case APP_REINSTALL: + installApp(extras); break; case APP_UNINSTALL: + uninstallApp(extras); break; case CLEAR_APP_CACHE: - + clearAppData(extras); break; case FRONT_CAMERA: ToastUtil.debugShow("收到管控:行为查看"); @@ -248,10 +259,54 @@ public class PushManager { ToastUtil.debugShow("收到管控:恢复出厂"); ControlUtils.doMasterClear(mContext); break; + case HOMEWORK_NOTIFY: { + Intent intent = new Intent(mContext, NoticeActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + mContext.startActivity(intent); + } + break; default: } } + private void installApp(String extras) { + JsonObject jsonObject = GsonUtils.getJsonObject(extras); + try { + String pkg = jsonObject.get("package").getAsString(); + String app_url = jsonObject.get("app_url").getAsString(); + FileUtils.ariaDownload(mContext, app_url, jsonObject); + } catch (Exception e) { + Log.e(TAG, "installApp: " + e.getMessage()); + } + } + + private void clearAppData(String extras) { + JsonObject jsonObject = GsonUtils.getJsonObject(extras); + JsonElement jsonElement = jsonObject.get("package"); + if (!jsonElement.isJsonNull()) { + String pkg = jsonElement.getAsString(); + try { + new CacheUtils().clearApplicationUserData(mContext, pkg); + } catch (Exception e) { + Log.e(TAG, "clearAppData: " + e.getMessage()); + e.printStackTrace(); + } + } else { + Log.e(TAG, "clearAppData: null json"); + } + } + + private void uninstallApp(String extras) { + JsonObject jsonObject = GsonUtils.getJsonObject(extras); + JsonElement jsonElement = jsonObject.get("package"); + if (!jsonElement.isJsonNull()) { + String pkg = jsonElement.getAsString(); + ApkUtils.uninstallApp(mContext, pkg); + } else { + Log.e(TAG, "uninstallApp: null json"); + } + } + private void setControl(Context context, String type, String extras) { JsonObject jsonObject = GsonUtils.getJsonObject(extras); switch (type) { diff --git a/app/src/main/java/com/uiuipad/find/service/ManagerService.java b/app/src/main/java/com/uiuipad/find/service/ManagerService.java index bc8eb77..c971bff 100644 --- a/app/src/main/java/com/uiuipad/find/service/ManagerService.java +++ b/app/src/main/java/com/uiuipad/find/service/ManagerService.java @@ -33,17 +33,20 @@ import com.uiuipad.find.comm.CommonConfig; import com.uiuipad.find.network.NetInterfaceManager; import com.uiuipad.find.receiver.APKinstallReceiver; import com.uiuipad.find.receiver.BootReceiver; +import com.uiuipad.find.util.AppUtil; import com.uiuipad.find.util.ControlUtils; import com.uiuipad.find.util.TimeUtils; import java.util.concurrent.TimeUnit; +import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers; import io.reactivex.rxjava3.annotations.NonNull; import io.reactivex.rxjava3.core.Observable; import io.reactivex.rxjava3.core.ObservableEmitter; import io.reactivex.rxjava3.core.ObservableOnSubscribe; import io.reactivex.rxjava3.core.Observer; import io.reactivex.rxjava3.disposables.Disposable; +import io.reactivex.rxjava3.schedulers.Schedulers; /** * @author jgy02 @@ -152,12 +155,7 @@ public class ManagerService extends Service implements NetworkUtils.OnNetworkSta @Override public void onNext(String action) { Log.e("killObserver", "onNext: " + action); -// ControlUtils.killPackage(ManagerService.this, JGYUtils.PACKAGE_APPSTORE); -// int is_activation = Settings.Global.getInt(getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 0); -// Log.e(TAG, "onReceive: is_activation = " + is_activation); -// if (is_activation == 0) { -// ControlUtils.killPackage(ManagerService.this, JGYUtils.PACKAGE_OS); -// } + killApp(); } @Override @@ -171,6 +169,21 @@ public class ManagerService extends Service implements NetworkUtils.OnNetworkSta } }; + private void killApp() { + Log.e(TAG, "killApp: "); + AppUtil.killPackage(ManagerService.this, "com.jxw.mskt.video"); + AppUtil.killPackage(ManagerService.this, "com.jxw.teacher.video"); + AppUtil.killPackage(ManagerService.this, "com.jxw.newyouer.video"); + AppUtil.killPackage(ManagerService.this, "com.jxw.question"); + AppUtil.killPackage(ManagerService.this, "com.jxw.launcher"); + AppUtil.killPackage(ManagerService.this, "com.uiui.zysn"); + AppUtil.killPackage(ManagerService.this, "com.uiui.sn"); + AppUtil.killPackage(ManagerService.this, "com.uiui.appstore"); + AppUtil.killPackage(ManagerService.this, "com.uiui.zy"); + AppUtil.killPackage(ManagerService.this, "com.uiui.zyappstore"); + AppUtil.killPackage(ManagerService.this, "com.sohu.inputmethod.sogou"); + } + @Override public IBinder onBind(Intent intent) { return null; @@ -204,6 +217,34 @@ public class ManagerService extends Service implements NetworkUtils.OnNetworkSta .throttleLast(3, TimeUnit.MINUTES) // .throttleLast(3, TimeUnit.SECONDS) .subscribe(killObserver); + + Observable.interval(0, 3, TimeUnit.MINUTES) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Observer() { + @Override + public void onSubscribe(@NonNull Disposable d) { + Log.e("interval", "onSubscribe: "); + } + + @Override + public void onNext(@NonNull Long aLong) { + Log.e("interval", "onNext: " + aLong); + if (!ControlUtils.getScreenStatus(ManagerService.this)) { + killApp(); + } + } + + @Override + public void onError(@NonNull Throwable e) { + Log.e("interval", "onError: " + e.getMessage()); + } + + @Override + public void onComplete() { + Log.e("interval", "onComplete: "); + } + }); } @Override diff --git a/app/src/main/java/com/uiuipad/find/service/SocketService.java b/app/src/main/java/com/uiuipad/find/service/SocketService.java index 68ba2d0..b96a373 100644 --- a/app/src/main/java/com/uiuipad/find/service/SocketService.java +++ b/app/src/main/java/com/uiuipad/find/service/SocketService.java @@ -105,13 +105,14 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat case Intent.ACTION_USER_PRESENT: case Intent.ACTION_SCREEN_ON: mHandler.post(heartBeatRunnable);//开启心跳检测 - sendMsg(1); +// sendMsg(1); break; case Intent.ACTION_SCREEN_OFF: case Intent.ACTION_SHUTDOWN: case Intent.ACTION_FACTORY_RESET: case Intent.ACTION_MASTER_CLEAR: - sendMsg(0); +// sendMsg(0); + closeConnect(); break; default: break; @@ -200,13 +201,14 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat public void sendMsg() { JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("sn", Utils.getSerial()); - PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); - if (!pm.isScreenOn()) { - jsonObject.addProperty("is_online", 0); - //熄屏状态 - } else { - jsonObject.addProperty("is_online", 1); - } + jsonObject.addProperty("type", "ping"); +// PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); +// if (!pm.isScreenOn()) { +// jsonObject.addProperty("is_online", 0); +// //熄屏状态 +// } else { +// jsonObject.addProperty("is_online", 1); +// } if (null != client) { Log.i("JWebSocketClientService", "发送的消息:" + jsonObject.toString()); client.send(jsonObject.toString()); @@ -266,7 +268,9 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat } else { //如果client已为空,重新初始化连接 client = null; - initSocketClient(); + if (ControlUtils.getScreenStatus(SocketService.this)) { + initSocketClient(); + } } //每隔一定的时间,对长连接进行一次心跳检测 if (ControlUtils.getScreenStatus(SocketService.this)) { diff --git a/app/src/main/java/com/uiuipad/find/service/main/MainService.java b/app/src/main/java/com/uiuipad/find/service/main/MainService.java index 3e0db2b..6e97e24 100644 --- a/app/src/main/java/com/uiuipad/find/service/main/MainService.java +++ b/app/src/main/java/com/uiuipad/find/service/main/MainService.java @@ -1,5 +1,7 @@ package com.uiuipad.find.service.main; +import android.app.ActivityManagerNative; +import android.app.IActivityManager; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; @@ -11,6 +13,7 @@ import android.content.IntentFilter; import android.os.Binder; import android.os.Build; import android.os.IBinder; +import android.os.RemoteException; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; @@ -36,9 +39,11 @@ import com.uiuipad.find.bean.aolelearn.AoleAppInfo; import com.uiuipad.find.bean.jxw.JxwResponse; import com.uiuipad.find.comm.CommonConfig; import com.uiuipad.find.gson.GsonUtils; +import com.uiuipad.find.hook.KuxinActivityController; import com.uiuipad.find.network.NetInterfaceManager; import com.uiuipad.find.util.ApkUtils; import com.uiuipad.find.util.AppUtil; +import com.uiuipad.find.util.Utils; import org.jetbrains.annotations.NotNull; @@ -88,7 +93,9 @@ public class MainService extends Service implements MainSContact.MainView, Netwo @Override public void onConnected(NetworkUtils.NetworkType networkType) { - mPresenter.updateSnInfo(); + if (Utils.isScreenOn(MainService.this)) { + mPresenter.updateSnInfo(); + } } @Override @@ -104,7 +111,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo } } - private static KillAppListener killAppListener; +// private static KillAppListener killAppListener; public interface KillAppListener { void killApp(String action); @@ -113,12 +120,12 @@ public class MainService extends Service implements MainSContact.MainView, Netwo private final ObservableOnSubscribe killSubscribe = new ObservableOnSubscribe() { @Override public void subscribe(ObservableEmitter emitter) throws Exception { - killAppListener = new KillAppListener() { - @Override - public void killApp(String action) { - emitter.onNext(action); - } - }; +// killAppListener = new KillAppListener() { +// @Override +// public void killApp(String action) { +// emitter.onNext(action); +// } +// }; } }; @@ -136,8 +143,12 @@ public class MainService extends Service implements MainSContact.MainView, Netwo AppUtil.killPackage(MainService.this, "com.jxw.newyouer.video"); AppUtil.killPackage(MainService.this, "com.jxw.question"); AppUtil.killPackage(MainService.this, "com.jxw.launcher"); - AppUtil.killPackage(MainService.this, "com.uiui.zyappstore"); AppUtil.killPackage(MainService.this, "com.uiui.zysn"); + AppUtil.killPackage(MainService.this, "com.uiui.sn"); + AppUtil.killPackage(MainService.this, "com.uiui.appstore"); + AppUtil.killPackage(MainService.this, "com.uiui.zy"); + AppUtil.killPackage(MainService.this, "com.uiui.zyappstore"); + AppUtil.killPackage(MainService.this, "com.sohu.inputmethod.sogou"); } @Override @@ -160,10 +171,20 @@ public class MainService extends Service implements MainSContact.MainView, Netwo mPresenter.attachView(this); Aria.download(this).register(); - Observable.create(killSubscribe) - .throttleLast(3, TimeUnit.MINUTES) -// .throttleLast(3, TimeUnit.SECONDS) - .subscribe(killObserver); +// Observable.create(killSubscribe) +// .throttleLast(3, TimeUnit.MINUTES) +//// .throttleLast(3, TimeUnit.SECONDS) +// .subscribe(killObserver); + +// IActivityManager activityManager = ActivityManagerNative.getDefault(); +// try { +// activityManager.setActivityController(new KuxinActivityController(), true); +// } catch (RemoteException e) { +// Log.e(TAG, "setActivityController: " + e.getMessage()); +// e.printStackTrace(); +// } +// IServiceManager iServiceManager = ServiceManagerNative.asInterface(); +// ServiceManager serviceManager = getSystemService() registerReceivers(); NetworkUtils.registerNetworkStatusChangedListener(this); @@ -281,7 +302,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo case Intent.ACTION_SHUTDOWN: case Intent.ACTION_FACTORY_RESET: case Intent.ACTION_MASTER_CLEAR: - killAppListener.killApp(action); +// killAppListener.killApp(action); break; default: break; @@ -367,7 +388,8 @@ public class MainService extends Service implements MainSContact.MainView, Netwo @Override public void getSelfAppFinish() { NetInterfaceManager.getInstance().updateAppInstall(); - mPresenter.getSnIsActivation(); + // TODO: 2023/11/29 暂时屏蔽 +// mPresenter.getSnIsActivation(); } @Override diff --git a/app/src/main/java/com/uiuipad/find/util/ControlUtils.java b/app/src/main/java/com/uiuipad/find/util/ControlUtils.java index 5f1bbd1..8b2e71f 100644 --- a/app/src/main/java/com/uiuipad/find/util/ControlUtils.java +++ b/app/src/main/java/com/uiuipad/find/util/ControlUtils.java @@ -175,7 +175,7 @@ public class ControlUtils { public static void disableSystemControl(Context context) { setUsbState(context, 0); setBluetooth(context, 1); - setDeveloperOptions(context, 0); + setDeveloperOptions(context, 1); setCanReset(context, 1); setActionBar(context, 1); // setNavigationBar(context, 0); @@ -220,7 +220,7 @@ public class ControlUtils { Settings.Global.putInt(context.getContentResolver(), Settings.Global.ADB_ENABLED, status); } Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, status); - if (status == 1) { + if (status == 0) { Intent intent = new Intent(); intent.setAction("qch_developeroptions_close"); intent.setPackage("com.android.settings"); diff --git a/app/src/main/java/com/uiuipad/find/util/FileUtils.java b/app/src/main/java/com/uiuipad/find/util/FileUtils.java index 3957920..60dac64 100644 --- a/app/src/main/java/com/uiuipad/find/util/FileUtils.java +++ b/app/src/main/java/com/uiuipad/find/util/FileUtils.java @@ -7,6 +7,7 @@ import android.util.Log; import androidx.core.content.ContextCompat; import com.arialyy.aria.core.Aria; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; import java.io.File; @@ -15,11 +16,13 @@ import java.math.BigInteger; import java.security.MessageDigest; public class FileUtils { + private static final String TAG = FileUtils.class.getSimpleName(); public static String getDownLoadPath(Context context) { - String path = ContextCompat.getExternalFilesDirs(context, Environment.DIRECTORY_DOWNLOADS)[0].getAbsolutePath(); - return path + File.separator; -} + String path = ContextCompat.getExternalFilesDirs(context, Environment.DIRECTORY_DOWNLOADS)[0].getAbsolutePath(); + return path + File.separator; + } + public static String getFileNamefromURL(String url) { int position = url.lastIndexOf("/"); return url.substring(position + 1); @@ -62,7 +65,18 @@ public class FileUtils { public static void ariaDownload(Context context, String url, JsonObject jsonObject) { String fileName = getFileNamefromURL(url); - String urlMD5 = jsonObject.get("app_md5").getAsString(); + JsonElement jsonElement = jsonObject.get("app_md5"); + if (jsonElement == null || jsonElement.isJsonNull()) { + Log.e(TAG, "ariaDownload: have not app_md5"); + Aria.download(context) + .load(url) //读取下载地址 + .setFilePath(getDownLoadPath(context) + fileName) + .ignoreFilePathOccupy() + .setExtendField(jsonObject.toString()) + .create(); //启动下载} + return; + } + String urlMD5 = jsonElement.getAsString(); Log.e("ariaDownload", "urlMD5=" + urlMD5); File file = new File(getDownLoadPath(context) + fileName); if (file.exists() && !file.isDirectory()) { diff --git a/app/src/main/java/com/uiuipad/find/util/ToastUtil.java b/app/src/main/java/com/uiuipad/find/util/ToastUtil.java index e26072f..755e436 100644 --- a/app/src/main/java/com/uiuipad/find/util/ToastUtil.java +++ b/app/src/main/java/com/uiuipad/find/util/ToastUtil.java @@ -10,7 +10,7 @@ import com.uiuipad.find.BuildConfig; import com.uiuipad.find.R; public class ToastUtil { - private static String TAG = ToastUtil.class.getSimpleName(); + private static final String TAG = ToastUtil.class.getSimpleName(); public static void show(final String msg) { ToastUtils.make() diff --git a/app/src/main/res/drawable/default_botton_bg.xml b/app/src/main/res/drawable/default_botton_bg.xml new file mode 100644 index 0000000..0abdaac --- /dev/null +++ b/app/src/main/res/drawable/default_botton_bg.xml @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-land/activity_main.xml b/app/src/main/res/layout-land/activity_main.xml index d48deff..157f4e0 100644 --- a/app/src/main/res/layout-land/activity_main.xml +++ b/app/src/main/res/layout-land/activity_main.xml @@ -187,7 +187,8 @@ @@ -236,7 +238,8 @@ @@ -236,14 +238,16 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 9918332..06bb122 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -42,4 +42,16 @@ true + diff --git a/app/src/main/res/xml/file_paths.xml b/app/src/main/res/xml/file_paths.xml new file mode 100644 index 0000000..c6e50a7 --- /dev/null +++ b/app/src/main/res/xml/file_paths.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/app/src/main/res/xml/network.xml b/app/src/main/res/xml/network.xml new file mode 100644 index 0000000..dca93c0 --- /dev/null +++ b/app/src/main/res/xml/network.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/phone/res/values/strings.xml b/app/src/phone/res/values/strings.xml new file mode 100644 index 0000000..3d4f3f8 --- /dev/null +++ b/app/src/phone/res/values/strings.xml @@ -0,0 +1,3 @@ + + 时间守护 + diff --git a/niceimageview/build.gradle b/niceimageview/build.gradle index 28f7369..9e64725 100644 --- a/niceimageview/build.gradle +++ b/niceimageview/build.gradle @@ -11,6 +11,14 @@ android { } buildTypes { + Aigo1071Debug {} + Aigo1071Release {} + UnisocS6688Debug {} + UnisocS6688Release {} + teclast8183Debug {} + teclast8183Release {} + G10PDebug {} + G10PRelease {} U807UserDebug {} U807Debug {} U807Release {} diff --git a/verification-view/build.gradle b/verification-view/build.gradle index ce2ee75..c064136 100644 --- a/verification-view/build.gradle +++ b/verification-view/build.gradle @@ -13,6 +13,14 @@ android { } buildTypes { + Aigo1071Debug {} + Aigo1071Release {} + UnisocS6688Debug {} + UnisocS6688Release {} + teclast8183Debug {} + teclast8183Release {} + G10PDebug {} + G10PRelease {} U807UserDebug {} U807Debug {} U807Release {}