Commit d144a634 d144a6345b098bd67fced8f7d52a7b5dbd11ec5c by lake

完成stb协议模拟

0 parents
Showing 51 changed files with 1996 additions and 0 deletions
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetSelector">
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
</SelectionState>
</selectionStates>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveExternalAnnotations" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ASMSmaliIdeaPluginConfiguration">
<asm skipDebug="true" skipFrames="true" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
/build
\ No newline at end of file
plugins {
alias(libs.plugins.android.application)
}
android {
namespace 'com.topdraw.iptvlaunchertest'
compileSdk 34
defaultConfig {
applicationId "com.topdraw.iptvlaunchertest"
minSdk 21
targetSdk 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures{
buildConfig true
}
flavorDimensions 'APP'
productFlavors{
chongqing{
dimension 'APP'
}
}
}
dependencies {
implementation libs.appcompat
implementation libs.material
implementation libs.activity
implementation libs.constraintlayout
testImplementation libs.junit
androidTestImplementation libs.ext.junit
androidTestImplementation libs.espresso.core
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.topdraw.iptvlaunchertest;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.topdraw.iptvlaunchertest", appContext.getPackageName());
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INSTALL_PACKAGES"/>
<uses-permission android:name="android.permission.DELETE_PACKAGES"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.IPTVLauncherTest"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
package com.topdraw.iptvlaunchertest;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.util.Log;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes-dex2jar.jar:com/iflytek/xirihelpersupervisor/util/ApkTool.class */
public class ApkTool {
private static final String TAG = "ApkTool";
private ApkTool28 mApkTool28;
private boolean mIsInstallApk;
public static boolean apkInstalled(Context context, String str) {
PackageInfo packageInfo;
boolean z = false;
try {
packageInfo = context.getPackageManager().getPackageInfo(str, 0);
} catch (PackageManager.NameNotFoundException e) {
packageInfo = null;
}
if (packageInfo != null) {
z = true;
}
return z;
}
public boolean execCommand(String str) {
Process process = null;
try {
Process process2 = null;
process = null;
try {
Process exec = Runtime.getRuntime().exec(str);
String readInputStream = readInputStream(exec.getErrorStream());
String readInputStream2 = readInputStream(exec.getInputStream());
exec.waitFor();
if (!readInputStream2.contains("Success")) {
process = exec;
process2 = exec;
if (readInputStream.contains("Failure")) {
if (exec == null) {
return false;
}
try {
exec.destroy();
return false;
} catch (Exception e) {
return false;
}
} else if (exec == null) {
return false;
} else {
try {
exec.destroy();
return false;
} catch (Exception e2) {
return false;
}
}
} else if (exec == null) {
return true;
} else {
try {
exec.destroy();
return true;
} catch (Exception e3) {
return true;
}
}
} catch (Exception e4) {
e4.printStackTrace();
if (process2 == null) {
return false;
}
try {
process2.destroy();
return false;
} catch (Exception e5) {
return false;
}
}
} catch (Throwable th) {
if (process != null) {
try {
process.destroy();
} catch (Exception e6) {
}
}
throw th;
}
}
public boolean execute(String str) {
Throwable th;
OutputStream outputStream = null;
Exception e;
Process process;
try {
outputStream = null;
str = null;
outputStream = null;
} catch (Throwable th2) {
th = th2;
}
try {
Process exec = Runtime.getRuntime().exec(str);
try {
OutputStream outputStream2 = exec.getOutputStream();
outputStream = outputStream2;
exec.waitFor();
CloseUtils.closeIO(outputStream2);
if (exec == null) {
return true;
}
exec.destroy();
return true;
} catch (Exception e2) {
e = e2;
process = exec;
e.printStackTrace();
CloseUtils.closeIO(outputStream);
if (process == null) {
return false;
}
process.destroy();
return false;
}
} catch (Exception e3) {
e = e3;
process = null;
} catch (Throwable th3) {
Process process2 = null;
if (0 != 0) {
process2.destroy();
}
throw th3;
}
return false;
}
private String readInputStream(InputStream inputStream) {
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String str = BuildConfig.FLAVOR;
while (true) {
try {
try {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
str = str + readLine;
} catch (IOException e) {
e.printStackTrace();
CloseUtils.closeIOQuietly(bufferedReader, inputStreamReader, inputStream);
}
} catch (Throwable th) {
CloseUtils.closeIOQuietly(bufferedReader, inputStreamReader, inputStream);
throw th;
}
}
CloseUtils.closeIOQuietly(bufferedReader, inputStreamReader, inputStream);
return str;
}
public List<String> getInstalledApk() {
List<PackageInfo> installedPackages = App.getInstance().getPackageManager().getInstalledPackages(0);
ArrayList arrayList = new ArrayList(5);
for (PackageInfo packageInfo : installedPackages) {
if ((packageInfo.applicationInfo.flags & 1) == 0) {
arrayList.add(packageInfo.packageName);
}
}
return arrayList;
}
public boolean isInstalling() {
return this.mIsInstallApk;
}
public boolean isPkgInstalled(String str) {
for (String str2 : getInstalledApk()) {
if (str2.equals(str)) {
return true;
}
}
return false;
}
public boolean silentInstall(String str) {
Log.d(TAG, "silentInstall SDK_INT: " + Build.VERSION.SDK_INT);
if (Build.VERSION.SDK_INT >= 28) {
if (this.mApkTool28 == null) {
this.mApkTool28 = new ApkTool28();
}
this.mIsInstallApk = true;
boolean install28 = this.mApkTool28.install28(str);
this.mIsInstallApk = false;
return install28;
}
this.mIsInstallApk = true;
execute("chmod 777 " + str + " \n");
boolean execCommand = execCommand("/system/bin/pm install -r " + str + "\n");
boolean z = execCommand;
if (!execCommand) {
execute("chmod 666 " + str + " \n");
z = execCommand("/system/bin/pm install -m -r " + str + "\n");
}
boolean z2 = z;
if (!z) {
execute("chmod 777 " + str + " \n");
z2 = execCommand("/system/bin/pm install -r --vendor OVT " + str + "\n");
}
this.mIsInstallApk = false;
return z2;
}
public void silentUninstall(String str) {
if (Build.VERSION.SDK_INT >= 28) {
if (this.mApkTool28 == null) {
this.mApkTool28 = new ApkTool28();
}
this.mApkTool28.uninstall28(str);
return;
}
execCommand("/system/bin/pm uninstall " + str);
}
}
package com.topdraw.iptvlaunchertest;
import android.annotation.TargetApi;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.pm.PackageInstaller;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
/* loaded from: classes-dex2jar.jar:com/iflytek/xirihelpersupervisor/util/ApkTool28.class */
public class ApkTool28 {
@TargetApi(28)
private boolean copyInstallFile(PackageInstaller packageInstaller, int i, String str) {
IOException e;
OutputStream outputStream;
PackageInstaller.Session session;
FileInputStream fileInputStream;
PackageInstaller.Session session2;
FileInputStream fileInputStream2 = null;
boolean z = true;
try {
File file = new File(str);
PackageInstaller.Session openSession = packageInstaller.openSession(i);
try {
outputStream = openSession.openWrite("base.apk", 0, file.length());
try {
fileInputStream2 = new FileInputStream(file);
} catch (IOException e2) {
e = e2;
fileInputStream = null;
} catch (Throwable th) {
th = th;
fileInputStream2 = null;
}
try {
byte[] bArr = new byte[65536];
while (true) {
int read = fileInputStream2.read(bArr);
if (read == -1) {
break;
}
outputStream.write(bArr, 0, read);
}
openSession.fsync(outputStream);
CloseUtils.closeIO(outputStream, fileInputStream2, openSession);
} catch (IOException e3) {
e = e3;
fileInputStream = fileInputStream2;
session = openSession;
try {
e.printStackTrace();
CloseUtils.closeIO(outputStream, fileInputStream, session);
z = false;
return z;
} catch (Throwable th2) {
session2 = session;
fileInputStream2 = fileInputStream;
CloseUtils.closeIO(outputStream, fileInputStream2, session2);
throw th2;
}
} catch (Throwable th3) {
session2 = openSession;
CloseUtils.closeIO(outputStream, fileInputStream2, session2);
throw th3;
}
} catch (IOException e4) {
e = e4;
fileInputStream = null;
outputStream = null;
session = openSession;
} catch (Throwable th4) {
fileInputStream2 = null;
outputStream = null;
session2 = openSession;
}
} catch (IOException e5) {
e = e5;
fileInputStream = null;
session = null;
outputStream = null;
} catch (Throwable th5) {
fileInputStream2 = null;
session2 = null;
outputStream = null;
}
return z;
}
@TargetApi(28)
private int createSession(PackageInstaller packageInstaller, PackageInstaller.SessionParams sessionParams) {
int i;
try {
i = packageInstaller.createSession(sessionParams);
} catch (IOException e) {
e.printStackTrace();
i = -1;
}
return i;
}
@TargetApi(28)
private boolean execInstallCommand(PackageInstaller packageInstaller, int i) {
PackageInstaller.Session session = null;
PackageInstaller.Session session2 = null;
try {
try {
PackageInstaller.Session openSession = packageInstaller.openSession(i);
session2 = openSession;
session = openSession;
openSession.commit(PendingIntent.getBroadcast(App.getInstance(), 1, new Intent(App.getInstance(), InstallResultReceiver.class), PendingIntent.FLAG_UPDATE_CURRENT).getIntentSender());
CloseUtils.closeIO(openSession);
return true;
} catch (Exception e) {
session2 = session;
e.printStackTrace();
CloseUtils.closeIO(session);
return false;
}
} catch (Throwable th) {
CloseUtils.closeIO(session2);
throw th;
}
}
@TargetApi(28)
public boolean install28(String str) {
File file = new File(str);
PackageInstaller packageInstaller = App.getInstance().getPackageManager().getPackageInstaller();
PackageInstaller.SessionParams sessionParams = new PackageInstaller.SessionParams(1);
sessionParams.setSize(file.length());
int createSession = createSession(packageInstaller, sessionParams);
if (createSession == -1 || !copyInstallFile(packageInstaller, createSession, str)) {
return false;
}
return execInstallCommand(packageInstaller, createSession);
}
@TargetApi(28)
public void uninstall28(String str) {
App.getInstance().getPackageManager().getPackageInstaller().uninstall(str, PendingIntent.getBroadcast(App.getInstance(), 1, new Intent(App.getInstance(), InstallResultReceiver.class), PendingIntent.FLAG_UPDATE_CURRENT).getIntentSender());
}
}
package com.topdraw.iptvlaunchertest;
import android.app.Application;
public class App extends Application {
private static App app = null;
public static App getInstance(){
return app;
}
@Override
public void onCreate() {
super.onCreate();
app = this;
}
}
package com.topdraw.iptvlaunchertest;
import java.io.Closeable;
import java.io.IOException;
public class CloseUtils {
private CloseUtils() {
throw new UnsupportedOperationException("u can't instantiate me...");
}
public static void closeIO(Closeable... closeableArr) {
if (closeableArr != null) {
try {
for (Closeable closeable : closeableArr) {
if (closeable != null) {
closeable.close();
continue;
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static void closeIOQuietly(Closeable... closeableArr) {
if (closeableArr != null) {
try {
for (Closeable closeable : closeableArr) {
if (closeable != null) {
closeable.close();
continue;
}
}
} catch (IOException e) {
}
}
}
}
package com.topdraw.iptvlaunchertest;
import android.util.Log;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
public class HttpDownloader {
private static final String TAG = HttpDownloader.class.getSimpleName();
public static final int SUCCESS = 1;
public static final int FAILED = -1;
private int iWaitSeconds = 300000;
private String mAddCookie = null;
private int mTimeout = 30000;
public class httpResponseInfo {
final HttpDownloader downloader;
public byte[] data = new byte[0];
public URL url = null;
public httpResponseInfo(HttpDownloader httpDownloader) {
this.downloader = httpDownloader;
}
}
private HttpURLConnection createDownloadConnection(String str, int i) {
HttpURLConnection httpURLConnection;
try {
httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
httpURLConnection.setUseCaches(false);
httpURLConnection.setInstanceFollowRedirects(true);
if (i > 0) {
httpURLConnection.setRequestProperty("RANGE", "bytes=" + String.valueOf(i) + "-");
}
httpURLConnection.setConnectTimeout(this.mTimeout);
httpURLConnection.setReadTimeout(this.mTimeout);
if (this.mAddCookie != null) {
httpURLConnection.setRequestProperty("Cookie", this.mAddCookie);
}
try {
httpURLConnection.connect();
} catch (Exception e) {
e.printStackTrace();
httpURLConnection = null;
}
} catch (Exception e2) {
e2.printStackTrace();
httpURLConnection = null;
}
return httpURLConnection;
}
public int download(String urlString, String saveFilePath) {
FileOutputStream outputStream = null;
try {
// 获取 HTTP 响应信息
httpResponseInfo responseInfo = getHttpResponse(urlString);
// 检查响应数据是否有效
if (responseInfo == null || responseInfo.data.length == 0) {
Log.e(TAG, "Failed to get valid HTTP response.");
return FAILED;
}
// 打开输出流
outputStream = new FileOutputStream(saveFilePath);
// 写入响应数据到文件
outputStream.write(responseInfo.data);
// 下载成功
Log.i(TAG, "Download complete: " + saveFilePath);
return SUCCESS; // 返回成功码
} catch (Exception e) {
e.printStackTrace();
return FAILED; // 下载失败
} finally {
// 关闭输出流
try {
if (outputStream != null) {
outputStream.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
public httpResponseInfo getHttpResponse(String str) {
httpResponseInfo httpresponseinfo = new httpResponseInfo(this);
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
httpURLConnection.setUseCaches(false);
httpURLConnection.setInstanceFollowRedirects(true);
httpURLConnection.setConnectTimeout(this.mTimeout);
httpURLConnection.setReadTimeout(this.mTimeout);
if (this.mAddCookie != null) {
httpURLConnection.setRequestProperty("Cookie", this.mAddCookie);
}
try {
httpURLConnection.connect();
int contentLength = httpURLConnection.getContentLength();
Log.d(TAG, "contentLength:" + contentLength);
InputStream inputStream = httpURLConnection.getInputStream();
int i = 0;
httpresponseinfo.url = httpURLConnection.getURL();
httpresponseinfo.data = new byte[contentLength];
byte[] bArr = new byte[1024];
while (i < contentLength) {
try {
int read = inputStream.read(bArr);
if (read <= 0) {
break;
}
System.arraycopy(bArr, 0, httpresponseinfo.data, i, read);
i += read;
} catch (Exception e) {
e.printStackTrace();
}
}
if (i != contentLength) {
Log.d(TAG,"get http response error. readLen:" + i + ",contentLen:" + contentLength);
httpresponseinfo.data = new byte[0];
httpresponseinfo.url = null;
}
inputStream.close();
httpURLConnection.disconnect();
} catch (Exception e2) {
e2.printStackTrace();
}
} catch (Exception e3) {
e3.printStackTrace();
httpresponseinfo.data = new byte[0];
httpresponseinfo.url = null;
}
return httpresponseinfo;
}
public void setCookie(String str) {
this.mAddCookie = str;
}
}
package com.topdraw.iptvlaunchertest;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class InstallResultReceiver extends BroadcastReceiver {
private static final String TAG = "InstallResultReceiver";
@Override
public void onReceive(Context context, Intent intent) {
if (intent == null) {
return;
}
if (intent.getIntExtra("android.content.pm.extra.STATUS", 1) == 0) {
Log.d(TAG, "onReceive: success");
} else {
Log.e(TAG, intent.getStringExtra("android.content.pm.extra.STATUS_MESSAGE"));
}
}
}
package com.topdraw.iptvlaunchertest;
import android.Manifest;
import android.content.pm.PermissionInfo;
import android.os.Build;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import java.security.acl.Permission;
public class MainActivity extends AppCompatActivity {
private WebView webView;
private STBAppManager stbAppManager;
private String[] permissions = new String[]{
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.INSTALL_PACKAGES
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_main);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
webView = findViewById(R.id.webview);
initWeb();
initObject();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(permissions,0);
}
webView.loadUrl("http://192.168.12.98:8080/JsAppLaunch/JsAppStartUp.html");
}
private void initWeb() {
WebSettings settings = webView.getSettings();
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setJavaScriptEnabled(true);
settings.setAllowContentAccess(true);
settings.setDatabaseEnabled(true);
settings.setAllowFileAccessFromFileURLs(true);
settings.setAllowUniversalAccessFromFileURLs(true);
}
private void initObject(){
this.stbAppManager = new STBAppManager(this);
webView.addJavascriptInterface(this.stbAppManager,"STBAppManager");
}
}
\ No newline at end of file
package com.topdraw.iptvlaunchertest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Environment;
import android.os.Looper;
import android.util.Log;
import android.webkit.JavascriptInterface;
import android.widget.Toast;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Random;
public class STBAppManager {
private static final String TAG = STBAppManager.class.getSimpleName();
private Context mContext;
private static HashMap<String, String> mInstallAppsMap = new HashMap<>();
private static final String StorePathName = Environment.getExternalStorageDirectory().getPath() + "/.topdrawdownapp";
public STBAppManager(Context mContext) {
this.mContext = mContext;
}
public class DownloadThread extends Thread {
private HttpDownloader mDownloader = new HttpDownloader();
private String mDownloaderUrl;
private String mStoreFilePath;
final STBAppManager tdManager;
public DownloadThread(STBAppManager tdManager, String url, String filePath) {
this.tdManager = tdManager;
this.mDownloaderUrl = url;
this.mStoreFilePath = filePath;
}
@Override
public void run() {
try {
if (HttpDownloader.SUCCESS == this.mDownloader.download(this.mDownloaderUrl, this.mStoreFilePath)) {
tdManager.installApp(this.mStoreFilePath);
return;
}
Log.e(TAG, "download file failed!!!");
Looper.prepare();
Toast.makeText(mContext, "", Toast.LENGTH_LONG).show();
Looper.loop();
} catch (Exception e) {
e.printStackTrace();
}
}
}
private Intent parseIntentMessage(String str) {
Intent intent = null;
JSONObject jSONObject = null;
try {
jSONObject = new JSONObject(str);
} catch (JSONException e) {
e.printStackTrace();
}
if (jSONObject != null) {
String str2 = null;
String str3 = null;
String str4 = null;
String str5 = null;
String str6 = null;
JSONArray jSONArray = null;
try {
str2 = jSONObject.getString("appName");
} catch (JSONException e2) {
e2.printStackTrace();
}
try {
str3 = jSONObject.getString("className");
} catch (JSONException e3) {
e3.printStackTrace();
}
try {
jSONObject.getString("intentType");
} catch (JSONException e4) {
e4.printStackTrace();
}
try {
str4 = jSONObject.getString("action");
} catch (JSONException e5) {
e5.printStackTrace();
}
try {
str5 = jSONObject.getString("category");
} catch (JSONException e6) {
e6.printStackTrace();
}
try {
str6 = jSONObject.getString("data");
} catch (JSONException e7) {
e7.printStackTrace();
}
try {
jSONArray = jSONObject.getJSONArray("extra");
} catch (JSONException e8) {
e8.printStackTrace();
}
Intent intent2 = (str4 == null || str4.equals("")) ? new Intent() : new Intent(str4);
intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (str2 != null && !str2.equals("")) {
intent2.setPackage(str2);
if (str3 != null && !str3.equals("")) {
String str7 = str3;
if (!str3.startsWith(str2)) {
str7 = str2 + "." + str3;
}
intent2.setClassName(str2, str7);
}
}
if (str5 != null && !str5.equals("")) {
intent2.addCategory(str5);
}
if (str6 != null && !str6.equals("")) {
intent2.setData(Uri.parse(str6));
}
intent = intent2;
if (jSONArray != null) {
intent = intent2;
if (jSONArray.length() > 0) {
Log.d("sktest", "extras.length():" + jSONArray.length());
int i = 0;
while (true) {
intent = intent2;
if (i >= jSONArray.length()) {
break;
}
String str8 = null;
try {
str8 = jSONArray.getJSONObject(i).getString("name");
} catch (JSONException e9) {
e9.printStackTrace();
}
String str9 = null;
try {
str9 = jSONArray.getJSONObject(i).getString("value");
} catch (JSONException e10) {
e10.printStackTrace();
}
if (!(str8 == null || str8.equals("") || str9 == null)) {
Log.d("sktest", "extras name:" + str8 + ", value:" + str9);
intent2.putExtra(str8, str9);
}
i++;
}
}
}
}
return intent;
}
@JavascriptInterface
public boolean checkPackage(String str) {
boolean z = false;
if (str != null) {
if ("".equals(str)) {
z = false;
} else {
try {
this.mContext.getPackageManager().getApplicationInfo(str, 8192);
z = true;
} catch (PackageManager.NameNotFoundException e) {
z = false;
}
}
}
return z;
}
@JavascriptInterface
public String getAppVersion(String str) {
String str2;
try {
PackageInfo packageInfo = this.mContext.getPackageManager().getPackageInfo(str, 0);
str2 = "";
if (packageInfo != null) {
str2 = packageInfo.versionName;
}
} catch (Exception e) {
e.printStackTrace();
str2 = "";
}
return str2;
}
@JavascriptInterface
public void installApp(String str) {
try {
Log.i("STBAppManager", "installApp");
if (str.startsWith("http://") || str.startsWith("https://")) {
new DownloadThread(this, str, generateStoreFileName(str)).start();
} else if (str.isEmpty()) {
Log.e("STBAppManager", "the apk path name is empty !!!");
Toast.makeText(this.mContext, "the apk path name is empty !!!", Toast.LENGTH_LONG).show();
} else {
String parseAPKFile = parseAPKFile(this.mContext, str);
Log.i("STBAppManager", "installApp ==> packageName = " + parseAPKFile + ",apkpathname = " + str);
File file = new File(str);
if (file != null && file.exists()) {
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction("android.intent.action.VIEW");
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
this.mContext.startActivity(intent);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@JavascriptInterface
public boolean isAppInstalled(String str) {
boolean z = false;
try {
if (this.mContext.getPackageManager().getApplicationInfo(str, 0) != null) {
z = true;
}
} catch (Exception e) {
e.printStackTrace();
}
return z;
}
@JavascriptInterface
public void restartAppByName(String str) {
startAppByName(str);
}
@JavascriptInterface
public void sendBroadcastByIntent(String str) {
Log.d("sktest", "sendBroadcastByIntent intentMessage:" + str);
Intent intent = new Intent(str);
if (intent != null && this.mContext != null) {
try {
this.mContext.sendBroadcast(intent);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@JavascriptInterface
public void startActivityByIntent(String str) {
Log.d("sktest", "startActivityByIntent intentMessage:" + str);
Intent parseIntentMessage = parseIntentMessage(str);
if (parseIntentMessage != null && this.mContext != null) {
try {
this.mContext.startActivity(parseIntentMessage);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@JavascriptInterface
public void startAppByIntent(String str) {
Log.d("sktest", "startAppByIntent intentMessage:" + str);
Intent parseIntentMessage = parseIntentMessage(str);
if (parseIntentMessage != null && this.mContext != null) {
try {
this.mContext.startActivity(parseIntentMessage);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@JavascriptInterface
public void startAppByName(String str) {
try {
Intent launchIntentForPackage = this.mContext.getPackageManager().getLaunchIntentForPackage(str);
if (launchIntentForPackage != null) {
this.mContext.startActivity(launchIntentForPackage);
}
} catch (Exception e) {
e.printStackTrace();
}
}
private String generateStoreFileName(String str) {
String newFileName = "";
try {
Log.i(TAG, "generateStoreFileName , apkpathname= " + str);
File file = new File(StorePathName);
if (!file.exists()) {
Log.i(TAG, "generateStoreFileName ,create storeFile");
file.mkdir();
}
String filePath = StorePathName + "/_tmp" + new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss_", Locale.getDefault()).format(new Date(System.currentTimeMillis()));
Random random = new Random();
for (int i = 0; i < 4; i++) {
filePath = filePath + random.nextInt(10);
}
String apkName = filePath + ".apk";
newFileName = apkName;
Log.i(TAG, "apkpathname = " + str + ",localApkStorePath = " + apkName);
newFileName = apkName;
} catch (Exception e) {
e.printStackTrace();
}
return newFileName;
}
private String parseAPKFile(Context context, String str) {
String packageName;
try {
Log.i(TAG, "parseAPKFile, apkFilePath= " + str);
PackageInfo packageArchiveInfo = context.getPackageManager().getPackageArchiveInfo(str, 0);
if (packageArchiveInfo != null) {
packageName = packageArchiveInfo.packageName;
} else {
Log.e(TAG, "parse apk failed!!!");
packageName = null;
}
} catch (Exception e) {
e.printStackTrace();
packageName = null;
}
return packageName;
}
}
package com.topdraw.iptvlaunchertest;
import android.os.Handler;
import android.os.Looper;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/* loaded from: classes-dex2jar.jar:com/iflytek/xirihelpersupervisor/util/TaskExecutor.class */
public class TaskExecutor {
private static final int CORE_POOL_SIZE;
private static final int CPU_COUNT;
private static final int KEEP_ALIVE = 1;
private static final int MAX_POOL_SIZE;
private static final int MAX_SCHEDULED_POOL_SIZE = 2;
private static ExecutorService sExecutorService = null;
private static ScheduledThreadPoolExecutor sScheduledThreadPoolExecutor = null;
private static Handler sMainHandler = null;
/* access modifiers changed from: private */
/* loaded from: classes-dex2jar.jar:com/iflytek/xirihelpersupervisor/util/TaskExecutor$DefaultThreadPoolFactory.class */
public static class DefaultThreadPoolFactory implements ThreadFactory {
private static final AtomicInteger THREAD_POOL_NUM = new AtomicInteger(1);
private final ThreadGroup group;
private final String namePrefix;
private final AtomicInteger threadNum = new AtomicInteger(1);
private final AtomicInteger totalThreadNum = new AtomicInteger(1);
DefaultThreadPoolFactory() {
SecurityManager securityManager = System.getSecurityManager();
this.group = securityManager != null ? securityManager.getThreadGroup() : Thread.currentThread().getThreadGroup();
this.namePrefix = "pool-id-" + THREAD_POOL_NUM.getAndIncrement();
}
@Override // java.util.concurrent.ThreadFactory
public Thread newThread(Runnable runnable) {
ThreadGroup threadGroup = this.group;
Thread thread = new Thread(threadGroup, runnable, this.namePrefix + " thread-id-" + this.threadNum.getAndIncrement() + " total-thread-num-" + this.totalThreadNum.getAndIncrement());
thread.setPriority(5);
if (thread.isDaemon()) {
thread.setDaemon(false);
}
return thread;
}
}
static {
int availableProcessors = Runtime.getRuntime().availableProcessors();
CPU_COUNT = availableProcessors;
CORE_POOL_SIZE = availableProcessors + 1;
MAX_POOL_SIZE = (availableProcessors * 2) + 1;
}
private static void ensureMainHandler() {
synchronized (TaskExecutor.class) {
try {
if (sMainHandler == null) {
sMainHandler = new Handler(Looper.getMainLooper());
}
} catch (Throwable th) {
throw th;
}
}
}
private static void ensureScheduledThreadPoolExector() {
synchronized (TaskExecutor.class) {
try {
if (sScheduledThreadPoolExecutor == null) {
sScheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(2);
}
} catch (Throwable th) {
throw th;
}
}
}
private static void ensureThreadPoolExecutor() {
synchronized (TaskExecutor.class) {
try {
if (sExecutorService == null) {
sExecutorService = new ThreadPoolExecutor(CORE_POOL_SIZE, MAX_POOL_SIZE, 1, TimeUnit.SECONDS, new LinkedBlockingDeque(), new DefaultThreadPoolFactory(), new ThreadPoolExecutor.DiscardOldestPolicy());
}
} catch (Throwable th) {
throw th;
}
}
}
public static void executeTask(Runnable runnable) {
ensureThreadPoolExecutor();
sExecutorService.submit(runnable);
}
public static <T> Future<?> executeTaskWithResult(Callable<T> callable) {
ensureThreadPoolExecutor();
return sExecutorService.submit(callable);
}
public static void runTaskOnUiThread(Runnable runnable) {
ensureMainHandler();
sMainHandler.post(runnable);
}
public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long j, long j2) {
ensureScheduledThreadPoolExector();
return sScheduledThreadPoolExecutor.scheduleAtFixedRate(runnable, j, j2, TimeUnit.MILLISECONDS);
}
public static ScheduledFuture<?> scheduledTask(long j, Runnable runnable) {
ensureScheduledThreadPoolExector();
return sScheduledThreadPoolExecutor.schedule(runnable, j, TimeUnit.MILLISECONDS);
}
public static void scheduledTaskOnUiThread(long j, Runnable runnable) {
ensureMainHandler();
sMainHandler.postDelayed(runnable, j);
}
public static void shutdown() {
ExecutorService executorService = sExecutorService;
if (executorService != null) {
executorService.shutdown();
sExecutorService = null;
}
}
}
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
No preview for this file type
No preview for this file type
No preview for this file type
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.IPTVLauncherTest" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your dark theme here. -->
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
</style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">IPTVLauncherTest</string>
</resources>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.IPTVLauncherTest" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style>
<style name="Theme.IPTVLauncherTest" parent="Base.Theme.IPTVLauncherTest" />
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>
\ No newline at end of file
package com.topdraw.iptvlaunchertest;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
}
\ No newline at end of file
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. For more details, visit
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
\ No newline at end of file
[versions]
agp = "8.6.1"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
appcompat = "1.7.0"
material = "1.12.0"
activity = "1.9.1"
constraintlayout = "2.1.4"
[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
No preview for this file type
#Wed Oct 09 11:06:49 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
pluginManagement {
repositories {
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "IPTVLauncherTest"
include ':app'