新增烽火盒子stb协议
Showing
21 changed files
with
2068 additions
and
15 deletions
... | @@ -4,6 +4,14 @@ | ... | @@ -4,6 +4,14 @@ |
4 | <selectionStates> | 4 | <selectionStates> |
5 | <SelectionState runConfigName="app"> | 5 | <SelectionState runConfigName="app"> |
6 | <option name="selectionMode" value="DROPDOWN" /> | 6 | <option name="selectionMode" value="DROPDOWN" /> |
7 | <DropdownSelection timestamp="2024-10-12T05:40:06.328823Z"> | ||
8 | <Target type="DEFAULT_BOOT"> | ||
9 | <handle> | ||
10 | <DeviceId pluginId="Default" identifier="serial=0123456789;connection=725ee2fc" /> | ||
11 | </handle> | ||
12 | </Target> | ||
13 | </DropdownSelection> | ||
14 | <DialogSelection /> | ||
7 | </SelectionState> | 15 | </SelectionState> |
8 | </selectionStates> | 16 | </selectionStates> |
9 | </component> | 17 | </component> | ... | ... |
... | @@ -8,7 +8,7 @@ android { | ... | @@ -8,7 +8,7 @@ android { |
8 | 8 | ||
9 | defaultConfig { | 9 | defaultConfig { |
10 | applicationId "com.topdraw.iptvlaunchertest" | 10 | applicationId "com.topdraw.iptvlaunchertest" |
11 | minSdk 21 | 11 | minSdk 19 |
12 | targetSdk 34 | 12 | targetSdk 34 |
13 | versionCode 1 | 13 | versionCode 1 |
14 | versionName "1.0" | 14 | versionName "1.0" |
... | @@ -30,6 +30,7 @@ android { | ... | @@ -30,6 +30,7 @@ android { |
30 | buildFeatures{ | 30 | buildFeatures{ |
31 | buildConfig true | 31 | buildConfig true |
32 | } | 32 | } |
33 | |||
33 | flavorDimensions 'APP' | 34 | flavorDimensions 'APP' |
34 | productFlavors{ | 35 | productFlavors{ |
35 | chongqing{ | 36 | chongqing{ | ... | ... |
... | @@ -4,7 +4,9 @@ | ... | @@ -4,7 +4,9 @@ |
4 | 4 | ||
5 | <uses-permission android:name="android.permission.INSTALL_PACKAGES"/> | 5 | <uses-permission android:name="android.permission.INSTALL_PACKAGES"/> |
6 | <uses-permission android:name="android.permission.DELETE_PACKAGES"/> | 6 | <uses-permission android:name="android.permission.DELETE_PACKAGES"/> |
7 | <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" /> | ||
7 | <uses-permission android:name="android.permission.INTERNET"/> | 8 | <uses-permission android:name="android.permission.INTERNET"/> |
9 | <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" /> | ||
8 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> | 10 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> |
9 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> | 11 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> |
10 | 12 | ... | ... |
1 | package com.topdraw.iptvlaunchertest; | 1 | package com.topdraw.iptvlaunchertest; |
2 | 2 | ||
3 | import android.Manifest; | 3 | import android.Manifest; |
4 | import android.content.pm.PermissionInfo; | ||
5 | import android.os.Build; | 4 | import android.os.Build; |
6 | import android.os.Bundle; | 5 | import android.os.Bundle; |
7 | import android.webkit.WebSettings; | 6 | import android.webkit.WebSettings; |
... | @@ -13,11 +12,9 @@ import androidx.core.graphics.Insets; | ... | @@ -13,11 +12,9 @@ import androidx.core.graphics.Insets; |
13 | import androidx.core.view.ViewCompat; | 12 | import androidx.core.view.ViewCompat; |
14 | import androidx.core.view.WindowInsetsCompat; | 13 | import androidx.core.view.WindowInsetsCompat; |
15 | 14 | ||
16 | import java.security.acl.Permission; | ||
17 | |||
18 | public class MainActivity extends AppCompatActivity { | 15 | public class MainActivity extends AppCompatActivity { |
19 | private WebView webView; | 16 | private WebView webView; |
20 | private STBAppManager stbAppManager; | 17 | |
21 | private String[] permissions = new String[]{ | 18 | private String[] permissions = new String[]{ |
22 | Manifest.permission.WRITE_EXTERNAL_STORAGE, | 19 | Manifest.permission.WRITE_EXTERNAL_STORAGE, |
23 | Manifest.permission.READ_EXTERNAL_STORAGE, | 20 | Manifest.permission.READ_EXTERNAL_STORAGE, |
... | @@ -52,8 +49,12 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -52,8 +49,12 @@ public class MainActivity extends AppCompatActivity { |
52 | settings.setAllowUniversalAccessFromFileURLs(true); | 49 | settings.setAllowUniversalAccessFromFileURLs(true); |
53 | } | 50 | } |
54 | 51 | ||
52 | //注册接口 | ||
55 | private void initObject(){ | 53 | private void initObject(){ |
56 | this.stbAppManager = new STBAppManager(this); | 54 | if(TestConfig.testDist==TestConfig.Skyworth){ |
57 | webView.addJavascriptInterface(this.stbAppManager,"STBAppManager"); | 55 | webView.addJavascriptInterface(new com.topdraw.iptvlaunchertest.sky.STBAppManager(this),"STBAppManager"); |
56 | }else if(TestConfig.testDist==TestConfig.FiberHome){ | ||
57 | webView.addJavascriptInterface(new com.topdraw.iptvlaunchertest.fh.STBAppManager(this),"STBAppManager"); | ||
58 | } | ||
58 | } | 59 | } |
59 | } | 60 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | package com.topdraw.iptvlaunchertest.fh; | ||
2 | |||
3 | import android.content.Context; | ||
4 | import android.content.pm.PackageInfo; | ||
5 | import android.text.TextUtils; | ||
6 | import android.util.Log; | ||
7 | |||
8 | public class FHActivityUtil { | ||
9 | public static String parseAppFile(Context context, String appName) { | ||
10 | String pkgName = null; | ||
11 | Log.d("FHActivityUtil", "parseAppFile appName = " + appName); | ||
12 | if((TextUtils.isEmpty(appName)) || context == null) { | ||
13 | return null; | ||
14 | } | ||
15 | |||
16 | try { | ||
17 | PackageInfo pkgInfo = context.getPackageManager().getPackageArchiveInfo(appName, 0); | ||
18 | if(pkgInfo != null) { | ||
19 | pkgName = pkgInfo.packageName; | ||
20 | } | ||
21 | |||
22 | Log.d("FHActivityUtil", "parseAppFile pkgName = " + pkgName); | ||
23 | } | ||
24 | catch(Exception e) { | ||
25 | e.printStackTrace(); | ||
26 | } | ||
27 | |||
28 | return pkgName; | ||
29 | } | ||
30 | } |
1 | package com.topdraw.iptvlaunchertest.fh; | ||
2 | |||
3 | import android.content.Context; | ||
4 | import android.os.Bundle; | ||
5 | import android.os.Handler; | ||
6 | import android.os.HandlerThread; | ||
7 | import android.os.Message; | ||
8 | import android.text.TextUtils; | ||
9 | import android.util.Log; | ||
10 | |||
11 | import com.topdraw.iptvlaunchertest.App; | ||
12 | |||
13 | import java.io.File; | ||
14 | import java.io.FileInputStream; | ||
15 | import java.io.FileOutputStream; | ||
16 | import java.io.InputStream; | ||
17 | import java.net.HttpURLConnection; | ||
18 | import java.net.SocketTimeoutException; | ||
19 | import java.net.URL; | ||
20 | import java.util.ArrayList; | ||
21 | import java.util.HashMap; | ||
22 | import java.util.Map; | ||
23 | |||
24 | public class FHDownLoadManager { | ||
25 | private static final int MSG_BASE = 7000; | ||
26 | private static final int MSG_FHIPTV_DLOAD_TASK_CANCEL = 7003; | ||
27 | private static final int MSG_FHIPTV_DLOAD_TASK_COPYFILE = 7005; | ||
28 | private static final int MSG_FHIPTV_DLOAD_TASK_START = 7001; | ||
29 | private static final int MSG_FHIPTV_DLOAD_TASK_TIMEOUT = 7004; | ||
30 | private static final String TAG = "FHDownLoadManager"; | ||
31 | private static final int TIMEOUT_VAR = 5000; | ||
32 | private static FHDownLoadManager mInstance = null; | ||
33 | private Context mContext = null; | ||
34 | private ArrayList<IDownLoadListener> mDownloadObserversList; | ||
35 | private IProgressDialogListener mProgressDialogObserver = null; | ||
36 | private HandlerThread mDLoadHandleThread = null; | ||
37 | private Handler mEventHandle = null; | ||
38 | private long mTaskCount = 0; | ||
39 | private String mCookie = null; | ||
40 | |||
41 | /* loaded from: classes-dex2jar.jar:com/fiberhome/iptv/common/FHDownLoadManager$HttpResponseInfo.class */ | ||
42 | public static class HttpResponseInfo { | ||
43 | public static byte[] data = new byte[0]; | ||
44 | public static URL url = null; | ||
45 | |||
46 | public HttpResponseInfo(FHDownLoadManager fHDownLoadManager) { | ||
47 | } | ||
48 | } | ||
49 | |||
50 | private FHDownLoadManager() { | ||
51 | this.mDownloadObserversList = null; | ||
52 | this.mContext = App.getInstance(); | ||
53 | this.mDownloadObserversList = new ArrayList<>(); | ||
54 | initEventHandleThread(); | ||
55 | } | ||
56 | |||
57 | public static boolean checkURLConnStatus(String str, int i) { | ||
58 | boolean z; | ||
59 | HttpURLConnection httpURLConnection = null; | ||
60 | HttpURLConnection httpURLConnection2 = null; | ||
61 | HttpURLConnection httpURLConnection3 = null; | ||
62 | Log.d(TAG, "checkURLConnStatus() URL = " + str + ", waitMilliSecond= " + i); | ||
63 | if (str.startsWith("file://")) { | ||
64 | int indexOf = str.indexOf(63); | ||
65 | int length = str.length(); | ||
66 | if (indexOf > 0) { | ||
67 | length = indexOf; | ||
68 | } | ||
69 | z = new File(str.substring(8, length)).exists(); | ||
70 | Log.d(TAG, "checkURLConnStatus() files exists = " + z); | ||
71 | } else { | ||
72 | try { | ||
73 | try { | ||
74 | try { | ||
75 | HttpURLConnection httpURLConnection4 = (HttpURLConnection) new URL(str).openConnection(); | ||
76 | httpURLConnection4.setUseCaches(false); | ||
77 | httpURLConnection4.setInstanceFollowRedirects(true); | ||
78 | httpURLConnection4.setConnectTimeout(i); | ||
79 | httpURLConnection4.setReadTimeout(i); | ||
80 | httpURLConnection4.connect(); | ||
81 | int responseCode = httpURLConnection4.getResponseCode(); | ||
82 | httpURLConnection3 = httpURLConnection4; | ||
83 | httpURLConnection = httpURLConnection4; | ||
84 | httpURLConnection2 = httpURLConnection4; | ||
85 | Log.d(TAG, "checkURLConnStatus() response code = " + responseCode); | ||
86 | boolean z2 = false; | ||
87 | if (responseCode >= 100) { | ||
88 | z2 = false; | ||
89 | if (responseCode < 400) { | ||
90 | z2 = true; | ||
91 | } | ||
92 | } | ||
93 | z = z2; | ||
94 | if (httpURLConnection4 != null) { | ||
95 | httpURLConnection4.disconnect(); | ||
96 | z = z2; | ||
97 | } | ||
98 | } catch (SocketTimeoutException e) { | ||
99 | httpURLConnection2 = httpURLConnection3; | ||
100 | e.printStackTrace(); | ||
101 | z = false; | ||
102 | if (httpURLConnection3 != null) { | ||
103 | httpURLConnection3.disconnect(); | ||
104 | z = false; | ||
105 | } | ||
106 | } | ||
107 | } catch (Exception e2) { | ||
108 | e2.printStackTrace(); | ||
109 | httpURLConnection2 = httpURLConnection; | ||
110 | sleepTime(i); | ||
111 | z = false; | ||
112 | if (httpURLConnection != null) { | ||
113 | httpURLConnection.disconnect(); | ||
114 | z = false; | ||
115 | } | ||
116 | } | ||
117 | } catch (Throwable th) { | ||
118 | if (httpURLConnection2 != null) { | ||
119 | httpURLConnection2.disconnect(); | ||
120 | } | ||
121 | throw th; | ||
122 | } | ||
123 | } | ||
124 | return z; | ||
125 | } | ||
126 | |||
127 | private boolean copyFile(String str, String str2, boolean z) { | ||
128 | FileInputStream fileInputStream; | ||
129 | Throwable th; | ||
130 | boolean z2 = false; | ||
131 | try { | ||
132 | FileInputStream fileInputStream2 = null; | ||
133 | FileOutputStream fileOutputStream = null; | ||
134 | FileOutputStream fileOutputStream2 = null; | ||
135 | Log.d(TAG, "copyFile srcPath=" + str + ", dstPath=" + str2); | ||
136 | try { | ||
137 | File file = new File(str); | ||
138 | String str3 = str2 + ".tmp"; | ||
139 | File file2 = new File(str3); | ||
140 | if (str != null && str.equals(str2)) { | ||
141 | Log.e(TAG, "ignore copyFile, src file and dst file is same."); | ||
142 | try { | ||
143 | if (0 != 0) { | ||
144 | throw new NullPointerException(); | ||
145 | } | ||
146 | z2 = true; | ||
147 | if (0 != 0) { | ||
148 | throw new NullPointerException(); | ||
149 | } | ||
150 | } catch (Exception e) { | ||
151 | e.printStackTrace(); | ||
152 | z2 = true; | ||
153 | } | ||
154 | } else if (!file.exists()) { | ||
155 | Log.e(TAG, "copyFile failed, src file is not existed, srcPath=" + str); | ||
156 | try { | ||
157 | if (0 != 0) { | ||
158 | throw new NullPointerException(); | ||
159 | } | ||
160 | z2 = false; | ||
161 | if (0 != 0) { | ||
162 | throw new NullPointerException(); | ||
163 | } | ||
164 | } catch (Exception e2) { | ||
165 | e2.printStackTrace(); | ||
166 | z2 = false; | ||
167 | } | ||
168 | } else { | ||
169 | if (file2.exists() && !file2.delete()) { | ||
170 | Log.e(TAG, "delete temp file failed."); | ||
171 | } | ||
172 | fileInputStream2 = new FileInputStream(file); | ||
173 | try { | ||
174 | FileOutputStream fileOutputStream3 = new FileOutputStream(file2); | ||
175 | try { | ||
176 | byte[] bArr = new byte[512]; | ||
177 | while (true) { | ||
178 | int read = fileInputStream2.read(bArr); | ||
179 | if (read <= 0) { | ||
180 | break; | ||
181 | } | ||
182 | fileOutputStream3.write(bArr, 0, read); | ||
183 | } | ||
184 | FHFileTool.deleteFile(str2); | ||
185 | FHFileTool.renameFile(str3, str2, z); | ||
186 | z2 = true; | ||
187 | if (fileInputStream2 != null) { | ||
188 | try { | ||
189 | fileInputStream2.close(); | ||
190 | } catch (Exception e3) { | ||
191 | e3.printStackTrace(); | ||
192 | } | ||
193 | } | ||
194 | if (fileOutputStream3 != null) { | ||
195 | fileOutputStream3.close(); | ||
196 | } | ||
197 | } catch (Exception e) { | ||
198 | fileOutputStream2 = fileOutputStream3; | ||
199 | e.printStackTrace(); | ||
200 | if (fileInputStream2 != null) { | ||
201 | try { | ||
202 | fileInputStream2.close(); | ||
203 | } catch (Exception e5) { | ||
204 | e5.printStackTrace(); | ||
205 | z2 = false; | ||
206 | } | ||
207 | } | ||
208 | z2 = false; | ||
209 | if (fileOutputStream2 != null) { | ||
210 | fileOutputStream2.close(); | ||
211 | z2 = false; | ||
212 | } | ||
213 | return z2; | ||
214 | } catch (Throwable th2) { | ||
215 | th = th2; | ||
216 | fileOutputStream = fileOutputStream3; | ||
217 | fileInputStream = fileInputStream2; | ||
218 | if (fileInputStream != null) { | ||
219 | try { | ||
220 | fileInputStream.close(); | ||
221 | } catch (Exception e6) { | ||
222 | e6.printStackTrace(); | ||
223 | throw th; | ||
224 | } | ||
225 | } | ||
226 | if (fileOutputStream != null) { | ||
227 | fileOutputStream.close(); | ||
228 | } | ||
229 | throw th; | ||
230 | } | ||
231 | } catch (Exception e) { | ||
232 | e.printStackTrace(); | ||
233 | } catch (Throwable th3) { | ||
234 | th = th3; | ||
235 | fileInputStream = fileInputStream2; | ||
236 | } | ||
237 | } | ||
238 | } catch (Exception e) { | ||
239 | e.printStackTrace(); | ||
240 | } | ||
241 | return z2; | ||
242 | } catch (Throwable th4) { | ||
243 | th = th4; | ||
244 | } | ||
245 | return z2; | ||
246 | } | ||
247 | |||
248 | private void dialogProgressChange(long j) { | ||
249 | if (this.mProgressDialogObserver != null) { | ||
250 | this.mProgressDialogObserver.onDialogProgressChange(j); | ||
251 | } | ||
252 | } | ||
253 | |||
254 | private void dismissProgressDialog() { | ||
255 | Log.d(TAG, "dismissProgressDialog() function in."); | ||
256 | if (this.mProgressDialogObserver != null) { | ||
257 | this.mProgressDialogObserver.onDismissProgressDialog(); | ||
258 | } | ||
259 | } | ||
260 | |||
261 | |||
262 | public void downloadTaskCopyFile(Bundle bundle) { | ||
263 | String string = bundle.getString("path_src"); | ||
264 | String string2 = bundle.getString("path_dst"); | ||
265 | long j = bundle.getLong("id"); | ||
266 | String string3 = bundle.getString("md5"); | ||
267 | boolean z = bundle.getBoolean("owner_only"); | ||
268 | if (new File(string2).exists() && FHFileTool.compareMD5(FHFileTool.getFileMD5(string2), string3)) { | ||
269 | Log.d(TAG, "ignore copy file task, file is exist and same, taskid= " + j); | ||
270 | } else if (copyFile(string, string2, z)) { | ||
271 | Log.d(TAG, "copy file task taskid= " + j + " success, saved to = " + string2); | ||
272 | } else { | ||
273 | Log.e(TAG, "copy file task failed, taskid= " + j); | ||
274 | } | ||
275 | } | ||
276 | |||
277 | public boolean downloadFile(String downloadURL, String saveFilePath, boolean progressDialog) { | ||
278 | FileOutputStream fileOutputStream = null; | ||
279 | InputStream stream = null; | ||
280 | HttpURLConnection conn = null; | ||
281 | boolean success = false; | ||
282 | try { | ||
283 | // 打印下载 URL | ||
284 | Log.d("FHDownLoadManager", "downloadFile() URL = " + downloadURL); | ||
285 | // 打开连接 | ||
286 | conn = (HttpURLConnection) new URL(downloadURL).openConnection(); | ||
287 | conn.setUseCaches(false); | ||
288 | conn.setInstanceFollowRedirects(true); | ||
289 | conn.setConnectTimeout(5000); | ||
290 | conn.setReadTimeout(5000); | ||
291 | // 如果存在 Cookie,则添加请求头 | ||
292 | if (this.mCookie != null) { | ||
293 | conn.setRequestProperty("Cookie", this.mCookie); | ||
294 | } | ||
295 | conn.setRequestProperty("Pragma", "no-cache"); | ||
296 | conn.setRequestProperty("Cache-Control", "no-cache"); | ||
297 | conn.setRequestProperty("Connection", "Keep-Alive"); | ||
298 | conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MS IE 6.0; (ziva))"); | ||
299 | |||
300 | // 建立连接 | ||
301 | conn.connect(); | ||
302 | int respCode = conn.getResponseCode(); | ||
303 | |||
304 | // 检查响应码 | ||
305 | if (respCode != 200) { | ||
306 | Log.e("FHDownLoadManager", "downloadFile() URL is not accessible, response code = " + respCode); | ||
307 | return false; | ||
308 | } | ||
309 | |||
310 | // 获取文件大小 | ||
311 | long contentLen = conn.getContentLength(); | ||
312 | if (contentLen <= 0) { | ||
313 | Log.e("FHDownLoadManager", "downloadFile() failed, content length is error, contentLen= " + contentLen); | ||
314 | return false; | ||
315 | } | ||
316 | |||
317 | // 显示进度对话框(如果需要) | ||
318 | if (progressDialog) { | ||
319 | this.showProgressDialog(contentLen); | ||
320 | } | ||
321 | |||
322 | // 准备读取数据 | ||
323 | long readLen = 0; | ||
324 | byte[] buffer = new byte[1024]; | ||
325 | stream = conn.getInputStream(); | ||
326 | File file = new File(saveFilePath); | ||
327 | |||
328 | // 如果文件已存在,删除旧文件 | ||
329 | if (file.exists() && !file.delete()) { | ||
330 | Log.e("FHDownLoadManager", "origin file delete failed!"); | ||
331 | } | ||
332 | |||
333 | // 打开文件输出流 | ||
334 | fileOutputStream = new FileOutputStream(file); | ||
335 | |||
336 | // 读取文件 | ||
337 | while (readLen < contentLen) { | ||
338 | int len = stream.read(buffer); | ||
339 | if (len <= 0) break; | ||
340 | |||
341 | fileOutputStream.write(buffer, 0, len); | ||
342 | fileOutputStream.flush(); | ||
343 | readLen += len; | ||
344 | |||
345 | // 更新进度 | ||
346 | if (progressDialog) { | ||
347 | this.dialogProgressChange(readLen); | ||
348 | } | ||
349 | } | ||
350 | |||
351 | // 检查是否完全下载 | ||
352 | if (readLen == contentLen) { | ||
353 | success = true; | ||
354 | } else { | ||
355 | Log.e("FHDownLoadManager", "downloadFile() error, readLen= " + readLen + ", contentLen= " + contentLen); | ||
356 | if (file.exists() && !file.delete()) { | ||
357 | Log.e("FHDownLoadManager", "file delete failed."); | ||
358 | } | ||
359 | } | ||
360 | |||
361 | } catch (Exception e) { | ||
362 | e.printStackTrace(); | ||
363 | } finally { | ||
364 | // 关闭输入流、文件流和连接 | ||
365 | try { | ||
366 | if (stream != null) { | ||
367 | stream.close(); | ||
368 | } | ||
369 | if (fileOutputStream != null) { | ||
370 | fileOutputStream.close(); | ||
371 | } | ||
372 | if (conn != null) { | ||
373 | conn.disconnect(); | ||
374 | } | ||
375 | } catch (Exception e) { | ||
376 | e.printStackTrace(); | ||
377 | } | ||
378 | |||
379 | // 隐藏进度对话框(如果需要) | ||
380 | if (progressDialog) { | ||
381 | this.dismissProgressDialog(); | ||
382 | } | ||
383 | } | ||
384 | |||
385 | return success; | ||
386 | } | ||
387 | |||
388 | public int downloadTaskProc(Bundle bundle) { | ||
389 | int i = 0; | ||
390 | String string = bundle.getString("md5"); | ||
391 | String string2 = bundle.getString("url"); | ||
392 | String string3 = bundle.getString("path_dst"); | ||
393 | long j = bundle.getLong("id"); | ||
394 | String string4 = bundle.getString("file_type"); | ||
395 | boolean z = bundle.getBoolean("auto_open"); | ||
396 | boolean z2 = bundle.getBoolean("dialog_progress"); | ||
397 | boolean z3 = bundle.getBoolean("owner_only"); | ||
398 | String str = null; | ||
399 | Log.d(TAG, "downloadTaskProc() function in"); | ||
400 | String str2 = string3; | ||
401 | if (!TextUtils.isEmpty(string3)) { | ||
402 | str2 = string3; | ||
403 | if (string3.endsWith("/")) { | ||
404 | File file = new File(string3.substring(0, string3.length() - 1)); | ||
405 | if (!file.exists() && !file.mkdir()) { | ||
406 | Log.d(TAG, "download dir is not exist, mkdir failed."); | ||
407 | } | ||
408 | if (!file.exists()) { | ||
409 | Log.e(TAG, "download file task failed, mkdir fail"); | ||
410 | i = -1; | ||
411 | } else { | ||
412 | String genSavedFileFullPath = genSavedFileFullPath(string2, string3); | ||
413 | str2 = genSavedFileFullPath; | ||
414 | if (TextUtils.isEmpty(genSavedFileFullPath)) { | ||
415 | Log.e(TAG, "download file task failed, saved path= " + string3); | ||
416 | i = -1; | ||
417 | } | ||
418 | } | ||
419 | return i; | ||
420 | } | ||
421 | } | ||
422 | String str3 = str2 + ".tmp"; | ||
423 | File file2 = new File(str2); | ||
424 | if (file2.exists()) { | ||
425 | str = FHFileTool.getFileMD5(str2); | ||
426 | } | ||
427 | if (file2.exists() && FHFileTool.compareMD5(str, string)) { | ||
428 | Log.d(TAG, "ignore download file task, file is existed and same, taskid=" + j); | ||
429 | i = 0; | ||
430 | } else if (!downloadFile(string2, str3, z2)) { | ||
431 | Log.e(TAG, "download file task failed, taskid=" + j); | ||
432 | i = -1; | ||
433 | } else { | ||
434 | File file3 = new File(str3); | ||
435 | if (!file3.exists() || file3.length() == 0) { | ||
436 | FHFileTool.deleteFile(str3); | ||
437 | Log.e(TAG, "download file failed"); | ||
438 | i = -1; | ||
439 | } else { | ||
440 | if (!TextUtils.isEmpty(string)) { | ||
441 | String fileMD5 = FHFileTool.getFileMD5(str3); | ||
442 | if (!FHFileTool.compareMD5(fileMD5, string)) { | ||
443 | FHFileTool.deleteFile(str3); | ||
444 | Log.e(TAG, "download file task failed, file md5 is NOK, fileMD5=" + fileMD5); | ||
445 | i = -1; | ||
446 | } | ||
447 | } | ||
448 | FHFileTool.deleteFile(str2); | ||
449 | FHFileTool.renameFile(str3, str2, z3); | ||
450 | Log.d(TAG, "download success, the file saved to:" + str2); | ||
451 | if (z) { | ||
452 | Log.d(TAG, "try to open file:" + str2); | ||
453 | String str4 = string4; | ||
454 | if (TextUtils.isEmpty(string4)) { | ||
455 | str4 = FHFileTool.getMIMEType(str2); | ||
456 | } | ||
457 | try { | ||
458 | if (!(this.mContext == null || str4 == null)) { | ||
459 | FHFileTool.openFile(this.mContext, str2, str4); | ||
460 | } | ||
461 | } catch (Exception e) { | ||
462 | e.printStackTrace(); | ||
463 | } | ||
464 | } | ||
465 | i = 1; | ||
466 | } | ||
467 | } | ||
468 | return i; | ||
469 | } | ||
470 | |||
471 | public static String genSavedFileFullPath(String str, String str2) { | ||
472 | String str3 = null; | ||
473 | String str4 = null; | ||
474 | try { | ||
475 | if (!TextUtils.isEmpty(str)) { | ||
476 | str4 = FHFileTool.getFileNameFromUrl(str); | ||
477 | } | ||
478 | String str5 = str4; | ||
479 | if (TextUtils.isEmpty(str4)) { | ||
480 | str5 = "unknownfile"; | ||
481 | } | ||
482 | str3 = str2 + str5; | ||
483 | } catch (Exception e) { | ||
484 | e.printStackTrace(); | ||
485 | } | ||
486 | return str3; | ||
487 | } | ||
488 | |||
489 | public static FHDownLoadManager getInstance() { | ||
490 | FHDownLoadManager fHDownLoadManager; | ||
491 | synchronized (FHDownLoadManager.class) { | ||
492 | try { | ||
493 | if (mInstance == null) { | ||
494 | mInstance = new FHDownLoadManager(); | ||
495 | } | ||
496 | fHDownLoadManager = mInstance; | ||
497 | } catch (Throwable th) { | ||
498 | throw th; | ||
499 | } | ||
500 | } | ||
501 | return fHDownLoadManager; | ||
502 | } | ||
503 | |||
504 | public static Map<String, String> getURLReqParams(String str) { | ||
505 | HashMap hashMap = new HashMap(); | ||
506 | String str2 = null; | ||
507 | if (!TextUtils.isEmpty(str)) { | ||
508 | str2 = null; | ||
509 | if (str.length() > 1) { | ||
510 | String[] split = str.trim().split("[?]"); | ||
511 | str2 = null; | ||
512 | if (split.length > 1) { | ||
513 | str2 = null; | ||
514 | if (split[1] != null) { | ||
515 | str2 = split[1]; | ||
516 | } | ||
517 | } | ||
518 | } | ||
519 | } | ||
520 | if (str2 != null) { | ||
521 | for (String str3 : str2.split("[&]")) { | ||
522 | String[] split2 = str3.split("[=]"); | ||
523 | if (split2.length > 1) { | ||
524 | hashMap.put(split2[0], split2[1]); | ||
525 | } else if (!TextUtils.isEmpty(split2[0])) { | ||
526 | hashMap.put(split2[0], ""); | ||
527 | } | ||
528 | } | ||
529 | } | ||
530 | return hashMap; | ||
531 | } | ||
532 | |||
533 | private void initEventHandleThread() { | ||
534 | this.mDLoadHandleThread = new HandlerThread("mDLoadHandleThread"); | ||
535 | this.mDLoadHandleThread.start(); | ||
536 | this.mEventHandle = new Handler(this.mDLoadHandleThread.getLooper()) { | ||
537 | |||
538 | @Override | ||
539 | public void handleMessage(Message message) { | ||
540 | Bundle data = message.getData(); | ||
541 | switch (message.what) { | ||
542 | case FHDownLoadManager.MSG_FHIPTV_DLOAD_TASK_START /* 7001 */: | ||
543 | downloadTaskProc(data); | ||
544 | return; | ||
545 | case 7002: | ||
546 | case FHDownLoadManager.MSG_FHIPTV_DLOAD_TASK_CANCEL /* 7003 */: | ||
547 | case FHDownLoadManager.MSG_FHIPTV_DLOAD_TASK_TIMEOUT /* 7004 */: | ||
548 | default: | ||
549 | return; | ||
550 | case FHDownLoadManager.MSG_FHIPTV_DLOAD_TASK_COPYFILE /* 7005 */: | ||
551 | downloadTaskCopyFile(data); | ||
552 | return; | ||
553 | } | ||
554 | } | ||
555 | }; | ||
556 | } | ||
557 | |||
558 | private void showProgressDialog(long j) { | ||
559 | Log.d(TAG, "showProgressDialog() max=" + j); | ||
560 | if (this.mProgressDialogObserver != null) { | ||
561 | this.mProgressDialogObserver.onShowProgressDialog("", j); | ||
562 | } | ||
563 | } | ||
564 | |||
565 | private static void sleepTime(int i) { | ||
566 | Log.d(TAG, "sleepTime milliSecond = " + i); | ||
567 | try { | ||
568 | Thread.sleep((long) i); | ||
569 | } catch (InterruptedException e) { | ||
570 | e.printStackTrace(); | ||
571 | try { | ||
572 | Thread.currentThread().interrupt(); | ||
573 | } catch (Exception e2) { | ||
574 | e2.printStackTrace(); | ||
575 | } | ||
576 | } | ||
577 | } | ||
578 | |||
579 | public long asyncCopyFile(String str, String str2, String str3, boolean z) { | ||
580 | long j = -1; | ||
581 | if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) { | ||
582 | Log.e(TAG, "copy file task failed, file path is empty"); | ||
583 | } else if (!FHFileTool.isFileExist(str)) { | ||
584 | Log.e(TAG, "copy file task failed, src file is not exist"); | ||
585 | } else { | ||
586 | this.mTaskCount++; | ||
587 | if (this.mTaskCount < 0) { | ||
588 | this.mTaskCount = 1; | ||
589 | } | ||
590 | Log.d(TAG, "copy file task is started, taskid= " + this.mTaskCount); | ||
591 | Bundle bundle = new Bundle(); | ||
592 | bundle.putString("path_src", str); | ||
593 | bundle.putString("path_dst", str2); | ||
594 | bundle.putLong("id", this.mTaskCount); | ||
595 | bundle.putBoolean("owner_only", z); | ||
596 | if (!TextUtils.isEmpty(str3)) { | ||
597 | bundle.putString("md5", str3); | ||
598 | } | ||
599 | Message message = new Message(); | ||
600 | message.setData(bundle); | ||
601 | message.what = MSG_FHIPTV_DLOAD_TASK_COPYFILE; | ||
602 | this.mEventHandle.sendMessage(message); | ||
603 | j = this.mTaskCount; | ||
604 | } | ||
605 | return j; | ||
606 | } | ||
607 | |||
608 | public long asyncDownloadFile(String str, String str2, boolean z, boolean z2, String str3, String str4, boolean z3) { | ||
609 | long j; | ||
610 | if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) { | ||
611 | j = -1; | ||
612 | } else { | ||
613 | this.mTaskCount++; | ||
614 | if (this.mTaskCount < 0) { | ||
615 | this.mTaskCount = 1; | ||
616 | } | ||
617 | Log.d(TAG, "download file task is started, taskid= " + this.mTaskCount); | ||
618 | Bundle bundle = new Bundle(); | ||
619 | bundle.putString("url", str); | ||
620 | bundle.putString("path_dst", str2); | ||
621 | if (!TextUtils.isEmpty(str4)) { | ||
622 | bundle.putString("md5", str4); | ||
623 | } | ||
624 | if (!TextUtils.isEmpty(str3)) { | ||
625 | bundle.putString("file_type", str3); | ||
626 | } | ||
627 | bundle.putBoolean("auto_open", z); | ||
628 | bundle.putBoolean("dialog_progress", z2); | ||
629 | bundle.putLong("id", this.mTaskCount); | ||
630 | bundle.putBoolean("owner_only", z3); | ||
631 | Message message = new Message(); | ||
632 | message.setData(bundle); | ||
633 | message.what = MSG_FHIPTV_DLOAD_TASK_START; | ||
634 | this.mEventHandle.sendMessage(message); | ||
635 | j = this.mTaskCount; | ||
636 | } | ||
637 | return j; | ||
638 | } | ||
639 | |||
640 | public void disregistDownloadObsever(IDownLoadListener iDownLoadListener) { | ||
641 | this.mDownloadObserversList.remove(iDownLoadListener); | ||
642 | } | ||
643 | |||
644 | public void disregistProgressDialogObsever(IProgressDialogListener iProgressDialogListener) { | ||
645 | this.mProgressDialogObserver = null; | ||
646 | } | ||
647 | |||
648 | |||
649 | public HttpResponseInfo getHttpResponse(String str) { | ||
650 | InputStream inputStream = null; | ||
651 | HttpURLConnection httpURLConnection = null; | ||
652 | HttpResponseInfo httpResponseInfo; | ||
653 | int read; | ||
654 | try { | ||
655 | HttpResponseInfo httpResponseInfo2 = new HttpResponseInfo(this); | ||
656 | InputStream inputStream2 = null; | ||
657 | HttpURLConnection httpURLConnection2 = null; | ||
658 | Log.d(TAG, "getHttpResponse() URL = " + str); | ||
659 | try { | ||
660 | HttpURLConnection httpURLConnection3 = (HttpURLConnection) new URL(str).openConnection(); | ||
661 | httpURLConnection3.setUseCaches(false); | ||
662 | httpURLConnection3.setInstanceFollowRedirects(true); | ||
663 | httpURLConnection3.setConnectTimeout(TIMEOUT_VAR); | ||
664 | httpURLConnection3.setReadTimeout(TIMEOUT_VAR); | ||
665 | if (this.mCookie != null) { | ||
666 | httpURLConnection3.setRequestProperty("Cookie", this.mCookie); | ||
667 | } | ||
668 | httpURLConnection3.setRequestProperty("Pragma", "no-cache"); | ||
669 | httpURLConnection3.setRequestProperty("Cache-Control", "no-cache"); | ||
670 | httpURLConnection3.setRequestProperty("Connection", "Keep-Alive"); | ||
671 | httpURLConnection3.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MS IE 6.0; (ziva))"); | ||
672 | httpURLConnection3.connect(); | ||
673 | int contentLength = httpURLConnection3.getContentLength(); | ||
674 | if (contentLength <= 0) { | ||
675 | try { | ||
676 | } catch (Exception e) { | ||
677 | e.printStackTrace(); | ||
678 | } | ||
679 | if (0 != 0) { | ||
680 | throw new NullPointerException(); | ||
681 | } | ||
682 | if (httpURLConnection3 != null) { | ||
683 | httpURLConnection3.disconnect(); | ||
684 | } | ||
685 | httpResponseInfo = null; | ||
686 | } else { | ||
687 | InputStream inputStream3 = httpURLConnection3.getInputStream(); | ||
688 | int i = 0; | ||
689 | HttpResponseInfo.url = httpURLConnection3.getURL(); | ||
690 | HttpResponseInfo.data = new byte[contentLength]; | ||
691 | byte[] bArr = new byte[1024]; | ||
692 | while (i < contentLength && (read = inputStream3.read(bArr)) > 0 && i + read <= contentLength) { | ||
693 | System.arraycopy(bArr, 0, HttpResponseInfo.data, i, read); | ||
694 | i += read; | ||
695 | } | ||
696 | if (i != contentLength) { | ||
697 | Log.e(TAG, "getHttpResponse error happen, readLen= " + i + ", contentLen= " + contentLength); | ||
698 | HttpResponseInfo.data = new byte[0]; | ||
699 | httpURLConnection2 = httpURLConnection3; | ||
700 | inputStream2 = inputStream3; | ||
701 | httpURLConnection = httpURLConnection3; | ||
702 | inputStream = inputStream3; | ||
703 | HttpResponseInfo.url = null; | ||
704 | } | ||
705 | if (inputStream3 != null) { | ||
706 | try { | ||
707 | inputStream3.close(); | ||
708 | } catch (Exception e2) { | ||
709 | e2.printStackTrace(); | ||
710 | httpResponseInfo = httpResponseInfo2; | ||
711 | } | ||
712 | } | ||
713 | httpResponseInfo = httpResponseInfo2; | ||
714 | if (httpURLConnection3 != null) { | ||
715 | httpURLConnection3.disconnect(); | ||
716 | httpResponseInfo = httpResponseInfo2; | ||
717 | } | ||
718 | } | ||
719 | } catch (Exception e3) { | ||
720 | e3.printStackTrace(); | ||
721 | if (inputStream2 != null) { | ||
722 | try { | ||
723 | inputStream2.close(); | ||
724 | } catch (Exception e4) { | ||
725 | e4.printStackTrace(); | ||
726 | httpResponseInfo = null; | ||
727 | } | ||
728 | } | ||
729 | httpResponseInfo = null; | ||
730 | if (httpURLConnection2 != null) { | ||
731 | httpURLConnection2.disconnect(); | ||
732 | httpResponseInfo = null; | ||
733 | } | ||
734 | } | ||
735 | return httpResponseInfo; | ||
736 | } catch (Throwable th) { | ||
737 | if (inputStream != null) { | ||
738 | try { | ||
739 | inputStream.close(); | ||
740 | } catch (Exception e5) { | ||
741 | e5.printStackTrace(); | ||
742 | throw th; | ||
743 | } | ||
744 | } | ||
745 | if (httpURLConnection != null) { | ||
746 | httpURLConnection.disconnect(); | ||
747 | } | ||
748 | throw th; | ||
749 | } | ||
750 | } | ||
751 | |||
752 | public void registDownloadObsever(IDownLoadListener iDownLoadListener) { | ||
753 | this.mDownloadObserversList.add(iDownLoadListener); | ||
754 | } | ||
755 | |||
756 | public void registProgressDialogObsever(IProgressDialogListener iProgressDialogListener) { | ||
757 | if (iProgressDialogListener != null) { | ||
758 | this.mProgressDialogObserver = iProgressDialogListener; | ||
759 | } | ||
760 | } | ||
761 | |||
762 | public void setCookie(String str) { | ||
763 | this.mCookie = str; | ||
764 | } | ||
765 | |||
766 | public int syncDownloadFile(String str, String str2, boolean z, boolean z2, String str3, String str4, boolean z3) { | ||
767 | int i; | ||
768 | if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) { | ||
769 | i = -1; | ||
770 | } else { | ||
771 | this.mTaskCount++; | ||
772 | if (this.mTaskCount < 0) { | ||
773 | this.mTaskCount = 1; | ||
774 | } | ||
775 | Bundle bundle = new Bundle(); | ||
776 | bundle.putString("url", str); | ||
777 | bundle.putString("path_dst", str2); | ||
778 | if (!TextUtils.isEmpty(str4)) { | ||
779 | bundle.putString("md5", str4); | ||
780 | } | ||
781 | if (!TextUtils.isEmpty(str3)) { | ||
782 | bundle.putString("file_type", str3); | ||
783 | } | ||
784 | bundle.putBoolean("auto_open", z); | ||
785 | bundle.putBoolean("dialog_progress", z2); | ||
786 | bundle.putLong("id", this.mTaskCount); | ||
787 | bundle.putBoolean("owner_only", z3); | ||
788 | i = downloadTaskProc(bundle); | ||
789 | } | ||
790 | return i; | ||
791 | } | ||
792 | } |
1 | package com.topdraw.iptvlaunchertest.fh; | ||
2 | |||
3 | import android.content.Context; | ||
4 | import android.content.Intent; | ||
5 | import android.net.Uri; | ||
6 | import android.text.TextUtils; | ||
7 | import android.util.Log; | ||
8 | import com.topdraw.iptvlaunchertest.App; | ||
9 | |||
10 | import java.io.File; | ||
11 | import java.io.FileInputStream; | ||
12 | import java.security.MessageDigest; | ||
13 | import java.util.Locale; | ||
14 | |||
15 | /* loaded from: classes-dex2jar.jar:com/fiberhome/iptv/common/FHFileTool.class */ | ||
16 | public class FHFileTool { | ||
17 | private static final String ASSETS_DIRECTORY = "file:///android_asset/html/"; | ||
18 | private static final String ASSETS_ERRORPAGE_PATH = "html/nodomain.html"; | ||
19 | private static final int ASSETS_FILE_TYPE = 1; | ||
20 | private static final String CUSTOM_DIRECTORY = "file:///system/opt/iptv/html/"; | ||
21 | private static final String CUSTOM_ERRORPAGE_PATH = "/system/opt/iptv/html/nodomain.html"; | ||
22 | private static final String[][] MIME_MapTable = {new String[]{".apk", "application/vnd.android.package-archive"}, new String[]{".3gp", "video/3gpp"}, new String[]{".asf", "video/x-ms-asf"}, new String[]{".avi", "video/x-msvideo"}, new String[]{".bin", "application/octet-stream"}, new String[]{".bmp", "image/bmp"}, new String[]{".c", "text/plain"}, new String[]{".class", "application/octet-stream"}, new String[]{".conf", "text/plain"}, new String[]{".cpp", "text/plain"}, new String[]{".doc", "application/msword"}, new String[]{".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"}, new String[]{".xls", "application/vnd.ms-excel"}, new String[]{".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}, new String[]{".exe", "application/octet-stream"}, new String[]{".gif", "image/gif"}, new String[]{".gtar", "application/x-gtar"}, new String[]{".gz", "application/x-gzip"}, new String[]{".h", "text/plain"}, new String[]{".htm", "text/html"}, new String[]{".html", "text/html"}, new String[]{".jar", "application/java-archive"}, new String[]{".java", "text/plain"}, new String[]{".js", "application/x-javascript"}, new String[]{".log", "text/plain"}, new String[]{".m3u", "audio/x-mpegurl"}, new String[]{".m4a", "audio/mp4a-latm"}, new String[]{".m4b", "audio/mp4a-latm"}, new String[]{".m4p", "audio/mp4a-latm"}, new String[]{".m4u", "video/vnd.mpegurl"}, new String[]{".m4v", "video/x-m4v"}, new String[]{".mov", "video/quicktime"}, new String[]{".mp3", "audio/x-mpeg"}, new String[]{".mp4", "video/mp4"}, new String[]{".mpc", "application/vnd.mpohun.certificate"}, new String[]{".mpe", "video/mpeg"}, new String[]{".mpeg", "video/mpeg"}, new String[]{".mpg", "video/mpeg"}, new String[]{".mpg4", "video/mp4"}, new String[]{".mpga", "audio/mpeg"}, new String[]{".msg", "application/vnd.ms-outlook"}, new String[]{".ogg", "audio/ogg"}, new String[]{".pdf", "application/pdf"}, new String[]{".jpeg", "image/jpeg"}, new String[]{".jpg", "image/jpeg"}, new String[]{".png", "image/png"}, new String[]{".pps", "application/vnd.ms-powerpoint"}, new String[]{".ppt", "application/vnd.ms-powerpoint"}, new String[]{".pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"}, new String[]{".prop", "text/plain"}, new String[]{".rc", "text/plain"}, new String[]{".rmvb", "audio/x-pn-realaudio"}, new String[]{".rtf", "application/rtf"}, new String[]{".sh", "text/plain"}, new String[]{".tar", "application/x-tar"}, new String[]{".tgz", "application/x-compressed"}, new String[]{".txt", "text/plain"}, new String[]{".wav", "audio/x-wav"}, new String[]{".wma", "audio/x-ms-wma"}, new String[]{".wmv", "audio/x-ms-wmv"}, new String[]{".wps", "application/vnd.ms-works"}, new String[]{".xml", "text/plain"}, new String[]{".z", "application/x-compress"}, new String[]{".zip", "application/x-zip-compressed"}, new String[]{"", "*/*"}}; | ||
23 | private static final int REGULAR_FILE_TYPE = 0; | ||
24 | private static final String TAG = "FHFileTool"; | ||
25 | |||
26 | public static void clearDirFiles(String str) { | ||
27 | if (!TextUtils.isEmpty(str)) { | ||
28 | Log.d(TAG, "clearDirFiles() dirPath = " + str); | ||
29 | File[] fileList = getFileList(str); | ||
30 | if (fileList == null) { | ||
31 | Log.d(TAG, "clearDirFiles() " + str + " is not exist"); | ||
32 | return; | ||
33 | } | ||
34 | try { | ||
35 | for (File file : fileList) { | ||
36 | Log.d(TAG, "clearDirFiles() delete " + file.getPath()); | ||
37 | if (!file.delete()) { | ||
38 | Log.e(TAG, "clearDirFiles() delete file failed"); | ||
39 | } | ||
40 | } | ||
41 | } catch (Exception e) { | ||
42 | e.printStackTrace(); | ||
43 | } | ||
44 | } | ||
45 | } | ||
46 | |||
47 | public static boolean compareMD5(String str, String str2) { | ||
48 | boolean z = false; | ||
49 | if (!TextUtils.isEmpty(str)) { | ||
50 | if (TextUtils.isEmpty(str2)) { | ||
51 | z = false; | ||
52 | } else { | ||
53 | String str3 = str; | ||
54 | if (str.length() != 32) { | ||
55 | str3 = Util.strLeftPad(str, 32, '0'); | ||
56 | } | ||
57 | String str4 = str2; | ||
58 | if (str2.length() != 32) { | ||
59 | str4 = Util.strLeftPad(str2, 32, '0'); | ||
60 | } | ||
61 | z = false; | ||
62 | if (str3.equalsIgnoreCase(str4)) { | ||
63 | z = true; | ||
64 | } | ||
65 | } | ||
66 | } | ||
67 | return z; | ||
68 | } | ||
69 | |||
70 | public static boolean deleteFile(String str) { | ||
71 | boolean z; | ||
72 | if (TextUtils.isEmpty(str)) { | ||
73 | z = false; | ||
74 | } else { | ||
75 | try { | ||
76 | File file = new File(str); | ||
77 | z = false; | ||
78 | if (file.exists()) { | ||
79 | z = false; | ||
80 | if (file.isFile()) { | ||
81 | Log.e(TAG, "deleteFile() file " + str); | ||
82 | if (!file.delete()) { | ||
83 | Log.e(TAG, "deleteFile() file failed."); | ||
84 | } | ||
85 | z = true; | ||
86 | } | ||
87 | } | ||
88 | } catch (Exception e) { | ||
89 | e.printStackTrace(); | ||
90 | z = false; | ||
91 | } | ||
92 | } | ||
93 | return z; | ||
94 | } | ||
95 | |||
96 | public static String getAppPackagePath() { | ||
97 | return App.getInstance().getFilesDir().getParent(); | ||
98 | } | ||
99 | |||
100 | public static String getFileExtension(String str) { | ||
101 | String lowerCase; | ||
102 | if (TextUtils.isEmpty(str)) { | ||
103 | lowerCase = ""; | ||
104 | } else { | ||
105 | int lastIndexOf = str.lastIndexOf(46); | ||
106 | if (lastIndexOf == -1) { | ||
107 | lowerCase = ""; | ||
108 | } else { | ||
109 | lowerCase = str.substring(lastIndexOf + 1).toLowerCase(Locale.US); | ||
110 | Log.d(TAG, "getFileExtension extension= " + lowerCase); | ||
111 | } | ||
112 | } | ||
113 | return lowerCase; | ||
114 | } | ||
115 | |||
116 | |||
117 | public static File[] getFileList(String str) { | ||
118 | File file = new File(str); | ||
119 | return (!file.exists() || !file.isDirectory()) ? null : file.listFiles(); | ||
120 | } | ||
121 | |||
122 | public static String getFileMD5(String str) { | ||
123 | Throwable th; | ||
124 | String str2 = ""; | ||
125 | FileInputStream fileInputStream = null; | ||
126 | FileInputStream fileInputStream2 = null; | ||
127 | byte[] bArr = new byte[1024]; | ||
128 | File file = new File(str); | ||
129 | if (!file.isFile()) { | ||
130 | Log.e(TAG, "getFileMD5() not a file."); | ||
131 | str2 = null; | ||
132 | } else { | ||
133 | try { | ||
134 | try { | ||
135 | MessageDigest instance = MessageDigest.getInstance("MD5"); | ||
136 | FileInputStream fileInputStream3 = new FileInputStream(file); | ||
137 | while (true) { | ||
138 | try { | ||
139 | int read = fileInputStream3.read(bArr, 0, 1024); | ||
140 | if (read == -1) { | ||
141 | break; | ||
142 | } | ||
143 | instance.update(bArr, 0, read); | ||
144 | } catch (Exception e) { | ||
145 | e = e; | ||
146 | fileInputStream2 = fileInputStream3; | ||
147 | fileInputStream = fileInputStream2; | ||
148 | e.printStackTrace(); | ||
149 | str2 = null; | ||
150 | if (fileInputStream2 != null) { | ||
151 | try { | ||
152 | fileInputStream2.close(); | ||
153 | str2 = null; | ||
154 | } catch (Exception e2) { | ||
155 | e2.printStackTrace(); | ||
156 | str2 = null; | ||
157 | } | ||
158 | } | ||
159 | return str2; | ||
160 | } catch (Throwable th2) { | ||
161 | th = th2; | ||
162 | fileInputStream = fileInputStream3; | ||
163 | if (fileInputStream != null) { | ||
164 | try { | ||
165 | fileInputStream.close(); | ||
166 | } catch (Exception e3) { | ||
167 | e3.printStackTrace(); | ||
168 | str2 = null; | ||
169 | } | ||
170 | } | ||
171 | throw th; | ||
172 | } | ||
173 | } | ||
174 | if (fileInputStream3 != null) { | ||
175 | try { | ||
176 | fileInputStream3.close(); | ||
177 | } catch (Exception e4) { | ||
178 | e4.printStackTrace(); | ||
179 | str2 = null; | ||
180 | } | ||
181 | } | ||
182 | str2 = Util.byte2Hex(instance.digest()); | ||
183 | Log.d(TAG, "getFileMD5() MD5= " + str2 + ", fileName= " + str); | ||
184 | } catch (Exception e5) { | ||
185 | e5.printStackTrace(); | ||
186 | } | ||
187 | } catch (Throwable th3) { | ||
188 | th = th3; | ||
189 | } | ||
190 | } | ||
191 | return str2; | ||
192 | } | ||
193 | |||
194 | public static String getFileNameFromUrl(String str) { | ||
195 | String str2; | ||
196 | try { | ||
197 | } catch (Exception e) { | ||
198 | e.printStackTrace(); | ||
199 | } | ||
200 | if (!TextUtils.isEmpty(str)) { | ||
201 | str2 = str.substring(str.lastIndexOf(47) + 1); | ||
202 | return str2; | ||
203 | } | ||
204 | str2 = null; | ||
205 | return str2; | ||
206 | } | ||
207 | |||
208 | public static String getFilePath(String str) { | ||
209 | return new File(str).getParent(); | ||
210 | } | ||
211 | |||
212 | public static String getMIMEType(String str) { | ||
213 | String str2 = "*/*"; | ||
214 | if (TextUtils.isEmpty(str)) { | ||
215 | str2 = null; | ||
216 | } else { | ||
217 | int lastIndexOf = str.lastIndexOf(46); | ||
218 | if (lastIndexOf < 0) { | ||
219 | str2 = "*/*"; | ||
220 | } else { | ||
221 | String lowerCase = str.substring(lastIndexOf).toLowerCase(); | ||
222 | if (TextUtils.isEmpty(lowerCase)) { | ||
223 | str2 = "*/*"; | ||
224 | } else { | ||
225 | for (int i = 0; i < MIME_MapTable.length; i++) { | ||
226 | if (lowerCase.equalsIgnoreCase(MIME_MapTable[i][0])) { | ||
227 | str2 = MIME_MapTable[i][1]; | ||
228 | } | ||
229 | } | ||
230 | } | ||
231 | } | ||
232 | } | ||
233 | return str2; | ||
234 | } | ||
235 | |||
236 | public static boolean isFileExist(File file) { | ||
237 | return file != null && file.exists(); | ||
238 | } | ||
239 | |||
240 | public static boolean isFileExist(String str) { | ||
241 | return isFileExist(new File(str)); | ||
242 | } | ||
243 | |||
244 | public static boolean isPictureType(String str) { | ||
245 | boolean z = false; | ||
246 | if (TextUtils.isEmpty(str)) { | ||
247 | z = false; | ||
248 | } else { | ||
249 | String fileExtension = getFileExtension(str); | ||
250 | if (TextUtils.isEmpty(fileExtension)) { | ||
251 | z = false; | ||
252 | } else if ("bmp".equals(fileExtension) || "gif".equals(fileExtension) || "jpeg".equals(fileExtension) || "jpg".equals(fileExtension) || "png".equals(fileExtension)) { | ||
253 | z = true; | ||
254 | } | ||
255 | } | ||
256 | return z; | ||
257 | } | ||
258 | |||
259 | public static boolean isVideoType(String str) { | ||
260 | boolean z = false; | ||
261 | if (TextUtils.isEmpty(str)) { | ||
262 | z = false; | ||
263 | } else { | ||
264 | String fileExtension = getFileExtension(str); | ||
265 | if (TextUtils.isEmpty(fileExtension)) { | ||
266 | z = false; | ||
267 | } else if ("avi".equals(fileExtension) || "asf".equals(fileExtension) || "asx".equals(fileExtension) || "divx".equals(fileExtension) || "flv".equals(fileExtension) || "f4v".equals(fileExtension) || "mpg".equals(fileExtension) || "mp4".equals(fileExtension) || "mov".equals(fileExtension) || "m2v".equals(fileExtension) || "m4v".equals(fileExtension) || "mkv".equals(fileExtension) || "m3u8".equals(fileExtension) || "ndivx".equals(fileExtension) || "ra".equals(fileExtension) || "ram".equals(fileExtension) || "rm".equals(fileExtension) || "rmvb".equals(fileExtension) || "swf".equals(fileExtension) || "ts".equals(fileExtension) || "v8".equals(fileExtension) || "wmv".equals(fileExtension) || "xvid".equals(fileExtension) || "3gp".equals(fileExtension) || "3gpp".equals(fileExtension) || "3gpp2".equals(fileExtension)) { | ||
268 | z = true; | ||
269 | } | ||
270 | } | ||
271 | return z; | ||
272 | } | ||
273 | |||
274 | |||
275 | public static boolean openFile(Context context, String str, String str2) { | ||
276 | Log.d(TAG, "openFile: " + str + ", openFileType=" + str2); | ||
277 | boolean z = false; | ||
278 | if (!TextUtils.isEmpty(str2)) { | ||
279 | if (context == null) { | ||
280 | z = false; | ||
281 | } else { | ||
282 | File file = new File(str); | ||
283 | if (!file.exists()) { | ||
284 | Log.d(TAG, "openFile failed, it is not existed"); | ||
285 | z = false; | ||
286 | } else { | ||
287 | Intent intent = new Intent(); | ||
288 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
289 | intent.setAction("android.intent.action.VIEW"); | ||
290 | intent.setDataAndType(Uri.fromFile(file), str2); | ||
291 | try { | ||
292 | context.startActivity(intent); | ||
293 | } catch (Exception e) { | ||
294 | e.printStackTrace(); | ||
295 | } | ||
296 | z = true; | ||
297 | } | ||
298 | } | ||
299 | } | ||
300 | return z; | ||
301 | } | ||
302 | |||
303 | public static void renameFile(String str, String str2, String str3) { | ||
304 | if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3) && !str2.equals(str3)) { | ||
305 | File file = new File(str + str2); | ||
306 | File file2 = new File(str + str3); | ||
307 | try { | ||
308 | if (!file2.exists() && !file.renameTo(file2)) { | ||
309 | Log.d(TAG, "renameFile failed."); | ||
310 | } | ||
311 | } catch (Exception e) { | ||
312 | e.printStackTrace(); | ||
313 | } | ||
314 | } | ||
315 | } | ||
316 | |||
317 | public static void renameFile(String str, String str2, boolean z) { | ||
318 | if (!TextUtils.isEmpty(str) && !TextUtils.isEmpty(str2) && !str.equals(str2)) { | ||
319 | File file = new File(str); | ||
320 | File file2 = new File(str2); | ||
321 | try { | ||
322 | if (!file.setReadable(true, z)) { | ||
323 | Log.d(TAG, "old file setReadable failed."); | ||
324 | } | ||
325 | if (!file.setWritable(true, z)) { | ||
326 | Log.d(TAG, "old file setWritable failed."); | ||
327 | } | ||
328 | if (!file2.setReadable(true, z)) { | ||
329 | Log.d(TAG, "new file setReadable failed."); | ||
330 | } | ||
331 | if (!file2.setWritable(true, z)) { | ||
332 | Log.d(TAG, "new file setWritable failed."); | ||
333 | } | ||
334 | if (!file2.exists() && !file.renameTo(file2)) { | ||
335 | Log.d(TAG, "renameFile failed, newPathName=" + str2); | ||
336 | } | ||
337 | } catch (Exception e) { | ||
338 | e.printStackTrace(); | ||
339 | } | ||
340 | } | ||
341 | } | ||
342 | } |
1 | package com.topdraw.iptvlaunchertest.fh; | ||
2 | |||
3 | import android.os.Bundle; | ||
4 | import android.text.TextUtils; | ||
5 | import android.util.Log; | ||
6 | |||
7 | import org.json.JSONArray; | ||
8 | import org.json.JSONObject; | ||
9 | |||
10 | import java.util.HashMap; | ||
11 | import java.util.Iterator; | ||
12 | import java.util.Map; | ||
13 | |||
14 | /** | ||
15 | * 烽火盒子启动参数解析工具 | ||
16 | */ | ||
17 | public class FHJsonUtil { | ||
18 | private static final String TAG = "FHJsonUtil"; | ||
19 | |||
20 | public static JSONArray getArray(String str) { | ||
21 | JSONArray jSONArray = null; | ||
22 | if (TextUtils.isEmpty(str)) { | ||
23 | Log.d(TAG, "getArray arrStr is null."); | ||
24 | jSONArray = null; | ||
25 | } else { | ||
26 | try { | ||
27 | jSONArray = new JSONArray(str); | ||
28 | } catch (Exception e) { | ||
29 | } | ||
30 | } | ||
31 | return jSONArray; | ||
32 | } | ||
33 | |||
34 | public static JSONArray getArrayParam(JSONObject jSONObject, String str) { | ||
35 | JSONArray jSONArray = null; | ||
36 | if (jSONObject == null || TextUtils.isEmpty(str)) { | ||
37 | Log.d(TAG, "getArrayParam jsonObj/name is null."); | ||
38 | jSONArray = null; | ||
39 | } else { | ||
40 | try { | ||
41 | jSONArray = jSONObject.getJSONArray(str); | ||
42 | } catch (Exception e) { | ||
43 | } | ||
44 | } | ||
45 | return jSONArray; | ||
46 | } | ||
47 | |||
48 | public static int getIntParam(JSONObject jSONObject, String str) { | ||
49 | int i = -1; | ||
50 | if (jSONObject == null || TextUtils.isEmpty(str)) { | ||
51 | Log.d(TAG, "getIntParam jsonObj/name is null."); | ||
52 | i = -1; | ||
53 | } else { | ||
54 | try { | ||
55 | i = jSONObject.getInt(str); | ||
56 | } catch (Exception e) { | ||
57 | } | ||
58 | Log.d(TAG, "getIntParam name = " + str + ", value = " + i); | ||
59 | } | ||
60 | return i; | ||
61 | } | ||
62 | |||
63 | public static int getIntParamFromString(String str, String str2) { | ||
64 | int i = -1; | ||
65 | if (TextUtils.isEmpty(str2)) { | ||
66 | Log.d(TAG, "getIntParamFromString name is null."); | ||
67 | i = -1; | ||
68 | } else { | ||
69 | JSONObject jsonObj = getJsonObj(str); | ||
70 | if (jsonObj == null) { | ||
71 | Log.d(TAG, "getIntParamFromString jsonObj null."); | ||
72 | i = -1; | ||
73 | } else { | ||
74 | try { | ||
75 | i = jsonObj.getInt(str2); | ||
76 | } catch (Exception e) { | ||
77 | } | ||
78 | Log.d(TAG, "getIntParamFromString name = " + str2 + ", value = " + i); | ||
79 | } | ||
80 | } | ||
81 | return i; | ||
82 | } | ||
83 | |||
84 | public static JSONObject getJsonObj(String str) { | ||
85 | JSONObject jSONObject; | ||
86 | if (TextUtils.isEmpty(str)) { | ||
87 | Log.d(TAG, "getJsonObj jsonStr is null."); | ||
88 | jSONObject = null; | ||
89 | } else { | ||
90 | try { | ||
91 | jSONObject = new JSONObject(str); | ||
92 | } catch (Exception e) { | ||
93 | jSONObject = null; | ||
94 | } | ||
95 | } | ||
96 | return jSONObject; | ||
97 | } | ||
98 | |||
99 | public static JSONObject getJsonObjFromArray(JSONArray jSONArray, int i) { | ||
100 | JSONObject jSONObject = null; | ||
101 | if (jSONArray == null) { | ||
102 | Log.d(TAG, "getJsonObjFromArray jsonArray is null."); | ||
103 | jSONObject = null; | ||
104 | } else { | ||
105 | try { | ||
106 | jSONObject = jSONArray.getJSONObject(i); | ||
107 | } catch (Exception e) { | ||
108 | } | ||
109 | } | ||
110 | return jSONObject; | ||
111 | } | ||
112 | |||
113 | public static JSONObject getJsonObjFromString(String str, int i) { | ||
114 | JSONObject jSONObject = null; | ||
115 | if (TextUtils.isEmpty(str)) { | ||
116 | Log.d(TAG, "getJsonObjFromString jsonStr is null."); | ||
117 | jSONObject = null; | ||
118 | } else { | ||
119 | try { | ||
120 | jSONObject = new JSONArray(str).getJSONObject(i); | ||
121 | } catch (Exception e) { | ||
122 | } | ||
123 | } | ||
124 | return jSONObject; | ||
125 | } | ||
126 | |||
127 | public static String getStrParam(JSONObject jSONObject, String str) { | ||
128 | String str2; | ||
129 | if (jSONObject == null || TextUtils.isEmpty(str)) { | ||
130 | Log.d(TAG, "getStrParam jsonObj/name is null."); | ||
131 | str2 = ""; | ||
132 | } else { | ||
133 | str2 = ""; | ||
134 | try { | ||
135 | if (jSONObject.has(str)) { | ||
136 | str2 = jSONObject.getString(str); | ||
137 | } | ||
138 | } catch (Exception e) { | ||
139 | str2 = ""; | ||
140 | } | ||
141 | Log.d(TAG, "getStrParam value = " + str2); | ||
142 | } | ||
143 | return str2; | ||
144 | } | ||
145 | |||
146 | public static String getStrParamFromString(String str, String str2) { | ||
147 | String str3; | ||
148 | if (TextUtils.isEmpty(str2)) { | ||
149 | Log.d(TAG, "getStrParamFromString name is null."); | ||
150 | str3 = ""; | ||
151 | } else { | ||
152 | JSONObject jsonObj = getJsonObj(str); | ||
153 | if (jsonObj == null) { | ||
154 | Log.d(TAG, "getStrParamFromString jsonObj is null."); | ||
155 | str3 = ""; | ||
156 | } else { | ||
157 | str3 = ""; | ||
158 | try { | ||
159 | if (jsonObj.has(str2)) { | ||
160 | str3 = jsonObj.getString(str2); | ||
161 | } | ||
162 | } catch (Exception e) { | ||
163 | str3 = ""; | ||
164 | } | ||
165 | Log.d(TAG, "getStrParamFromString value = " + str3); | ||
166 | } | ||
167 | } | ||
168 | return str3; | ||
169 | } | ||
170 | |||
171 | public static Bundle jsonStringToBundle(String str) { | ||
172 | Bundle bundle = new Bundle(); | ||
173 | if (TextUtils.isEmpty(str)) { | ||
174 | Log.d(TAG, "jsonStringToBundle jsonStr is null."); | ||
175 | } else { | ||
176 | try { | ||
177 | JSONObject jSONObject = new JSONObject(str); | ||
178 | Iterator<String> keys = jSONObject.keys(); | ||
179 | while (keys.hasNext()) { | ||
180 | String next = keys.next(); | ||
181 | Object obj = jSONObject.get(next); | ||
182 | if (obj instanceof Integer) { | ||
183 | bundle.putInt(next, ((Integer) obj).intValue()); | ||
184 | } else if (obj instanceof Long) { | ||
185 | bundle.putLong(next, ((Long) obj).longValue()); | ||
186 | } else if (obj instanceof Double) { | ||
187 | bundle.putDouble(next, ((Double) obj).doubleValue()); | ||
188 | } else if (obj instanceof String) { | ||
189 | bundle.putString(next, (String) obj); | ||
190 | } | ||
191 | } | ||
192 | } catch (Exception e) { | ||
193 | e.printStackTrace(); | ||
194 | } | ||
195 | } | ||
196 | return bundle; | ||
197 | } | ||
198 | |||
199 | public static Map jsonToMap(String str) { | ||
200 | HashMap hashMap = new HashMap(); | ||
201 | if (TextUtils.isEmpty(str)) { | ||
202 | Log.d(TAG, "jsonToMap jsonString is null."); | ||
203 | } else { | ||
204 | try { | ||
205 | JSONObject jSONObject = new JSONObject(str); | ||
206 | Iterator<String> keys = jSONObject.keys(); | ||
207 | while (keys.hasNext()) { | ||
208 | String next = keys.next(); | ||
209 | if (!TextUtils.isEmpty(next)) { | ||
210 | hashMap.put(next, jSONObject.getString(next)); | ||
211 | } | ||
212 | } | ||
213 | } catch (Exception e) { | ||
214 | } | ||
215 | } | ||
216 | return hashMap; | ||
217 | } | ||
218 | |||
219 | public static void putStrParam(JSONObject jSONObject, String str, String str2) { | ||
220 | if (jSONObject == null || TextUtils.isEmpty(str)) { | ||
221 | Log.d(TAG, "putStrParam jsonObj/name is null."); | ||
222 | return; | ||
223 | } | ||
224 | try { | ||
225 | jSONObject.put(str, str2); | ||
226 | } catch (Exception e) { | ||
227 | } | ||
228 | } | ||
229 | } |
1 | package com.topdraw.iptvlaunchertest.fh; | ||
2 | |||
3 | import static android.os.UserHandle.*; | ||
4 | |||
5 | import android.app.ActivityManager; | ||
6 | import android.content.ComponentName; | ||
7 | import android.content.Context; | ||
8 | import android.content.Intent; | ||
9 | import android.content.pm.PackageInfo; | ||
10 | import android.content.pm.PackageManager; | ||
11 | import android.graphics.Bitmap; | ||
12 | import android.net.Uri; | ||
13 | import android.os.Parcel; | ||
14 | import android.os.UserHandle; | ||
15 | import android.text.TextUtils; | ||
16 | import android.util.Log; | ||
17 | import android.webkit.JavascriptInterface; | ||
18 | import android.widget.Toast; | ||
19 | |||
20 | import com.topdraw.iptvlaunchertest.App; | ||
21 | |||
22 | import java.io.File; | ||
23 | import java.io.FileOutputStream; | ||
24 | import java.lang.reflect.Method; | ||
25 | import java.util.HashMap; | ||
26 | import java.util.Iterator; | ||
27 | import java.util.List; | ||
28 | |||
29 | import org.json.JSONArray; | ||
30 | import org.json.JSONException; | ||
31 | import org.json.JSONObject; | ||
32 | |||
33 | public class STBAppManager { | ||
34 | private static final String SAVED_FILE_PATH = "/sdcard/.downapp/"; | ||
35 | private static final String TAG = "STBAppManager"; | ||
36 | private static HashMap<String, String> mInstallAppTbl = new HashMap<>(); | ||
37 | private static STBAppManager mInstance = null; | ||
38 | private Context mContext; | ||
39 | |||
40 | public STBAppManager(Context context) { | ||
41 | this.mContext = context; | ||
42 | } | ||
43 | |||
44 | public static STBAppManager getInstance(Context context) { | ||
45 | STBAppManager sTBAppManager; | ||
46 | synchronized (STBAppManager.class) { | ||
47 | try { | ||
48 | if (mInstance == null) { | ||
49 | mInstance = new STBAppManager(context); | ||
50 | } | ||
51 | sTBAppManager = mInstance; | ||
52 | } catch (Throwable th) { | ||
53 | throw th; | ||
54 | } | ||
55 | } | ||
56 | return sTBAppManager; | ||
57 | } | ||
58 | |||
59 | private boolean getPersistentFlag(String str) { | ||
60 | boolean z; | ||
61 | if (TextUtils.isEmpty(str)) { | ||
62 | z = false; | ||
63 | } else { | ||
64 | z = false; | ||
65 | try { | ||
66 | if ((this.mContext.getPackageManager().getPackageInfo(str, 1).applicationInfo.flags & 8) != 0) { | ||
67 | z = true; | ||
68 | } | ||
69 | } catch (Exception e) { | ||
70 | } | ||
71 | } | ||
72 | return z; | ||
73 | } | ||
74 | |||
75 | private Intent parseIntentMessage(String str, int i) { | ||
76 | Intent intent; | ||
77 | ComponentName componentName; | ||
78 | Intent intent2; | ||
79 | JSONArray jSONArray = null; | ||
80 | JSONObject jsonObj = FHJsonUtil.getJsonObj(str); | ||
81 | if (jsonObj == null) { | ||
82 | intent = null; | ||
83 | } else { | ||
84 | int intParam = FHJsonUtil.getIntParam(jsonObj, "intentType"); | ||
85 | int i2 = intParam; | ||
86 | if (intParam == -1) { | ||
87 | i2 = 0; | ||
88 | } | ||
89 | String strParam = FHJsonUtil.getStrParam(jsonObj, "appName"); | ||
90 | String strParam2 = FHJsonUtil.getStrParam(jsonObj, "className"); | ||
91 | String strParam3 = FHJsonUtil.getStrParam(jsonObj, "action"); | ||
92 | String strParam4 = FHJsonUtil.getStrParam(jsonObj, "category"); | ||
93 | String strParam5 = FHJsonUtil.getStrParam(jsonObj, "data"); | ||
94 | if (jsonObj.has("extra")) { | ||
95 | jSONArray = FHJsonUtil.getArrayParam(jsonObj, "extra"); | ||
96 | } | ||
97 | Intent intent3 = null; | ||
98 | if (i == 1) { | ||
99 | intent3 = null; | ||
100 | if (i2 == 0) { | ||
101 | Intent parseIntentMessage = null; | ||
102 | if (TextUtils.isEmpty(strParam) || TextUtils.isEmpty(strParam2)) { | ||
103 | componentName = null; | ||
104 | intent2 = parseIntentMessage; | ||
105 | if (!TextUtils.isEmpty(strParam)) { | ||
106 | componentName = null; | ||
107 | intent2 = parseIntentMessage; | ||
108 | if (TextUtils.isEmpty(strParam2)) { | ||
109 | componentName = null; | ||
110 | intent2 = parseIntentMessage; | ||
111 | if (parseIntentMessage == null) { | ||
112 | try { | ||
113 | intent2 = this.mContext.getPackageManager().getLaunchIntentForPackage(strParam); | ||
114 | componentName = null; | ||
115 | } catch (Exception e) { | ||
116 | e.printStackTrace(); | ||
117 | componentName = null; | ||
118 | intent2 = parseIntentMessage; | ||
119 | } | ||
120 | } | ||
121 | } | ||
122 | } | ||
123 | } else { | ||
124 | componentName = new ComponentName(strParam, strParam2); | ||
125 | intent2 = parseIntentMessage; | ||
126 | } | ||
127 | Intent intent4 = intent2; | ||
128 | if (intent2 == null) { | ||
129 | intent4 = new Intent("android.intent.action.MAIN"); | ||
130 | intent4.addCategory("android.intent.category.LAUNCHER"); | ||
131 | intent4.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
132 | } | ||
133 | intent3 = intent4; | ||
134 | if (componentName != null) { | ||
135 | intent4.setComponent(componentName); | ||
136 | intent3 = intent4; | ||
137 | } | ||
138 | } | ||
139 | } | ||
140 | intent = intent3; | ||
141 | if (intent3 == null) { | ||
142 | Intent intent5 = new Intent(); | ||
143 | intent = intent5; | ||
144 | if (i2 == 1) { | ||
145 | intent5.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
146 | intent = intent5; | ||
147 | } | ||
148 | } | ||
149 | if (!TextUtils.isEmpty(strParam3)) { | ||
150 | intent.setAction(strParam3); | ||
151 | } | ||
152 | if (!TextUtils.isEmpty(strParam4)) { | ||
153 | intent.addCategory(strParam4); | ||
154 | } | ||
155 | if (!TextUtils.isEmpty(strParam5)) { | ||
156 | intent.setData(Uri.parse(strParam5)); | ||
157 | } | ||
158 | if (jSONArray != null && jSONArray.length() > 0) { | ||
159 | for (int i3 = 0; i3 < jSONArray.length(); i3++) { | ||
160 | JSONObject jsonObjFromArray = FHJsonUtil.getJsonObjFromArray(jSONArray, i3); | ||
161 | if (jsonObjFromArray != null) { | ||
162 | String strParam6 = FHJsonUtil.getStrParam(jsonObjFromArray, "name"); | ||
163 | String strParam7 = FHJsonUtil.getStrParam(jsonObjFromArray, "value"); | ||
164 | if (!TextUtils.isEmpty(strParam6) && !TextUtils.isEmpty(strParam7)) { | ||
165 | Log.d(TAG, "parseIntentMessage extra1 name = " + strParam6 + ", value = " + strParam7); | ||
166 | intent.putExtra(strParam6, strParam7); | ||
167 | } else if (TextUtils.isEmpty(strParam6) && TextUtils.isEmpty(strParam7)) { | ||
168 | Iterator<String> keys = jsonObjFromArray.keys(); | ||
169 | while (keys.hasNext()) { | ||
170 | String next = keys.next(); | ||
171 | try { | ||
172 | strParam7 = jsonObjFromArray.getString(next); | ||
173 | } catch (Exception e2) { | ||
174 | } | ||
175 | Log.d(TAG, "parseIntentMessage extra2 name = " + next + ", value = " + strParam7); | ||
176 | intent.putExtra(next, strParam7); | ||
177 | } | ||
178 | } | ||
179 | } | ||
180 | } | ||
181 | } | ||
182 | } | ||
183 | return intent; | ||
184 | } | ||
185 | |||
186 | |||
187 | @JavascriptInterface | ||
188 | public boolean cleanCache(String str) { | ||
189 | Log.d(TAG, "cleanCache pkgNames = " + str); | ||
190 | boolean z = false; | ||
191 | if (TextUtils.isEmpty(str)) { | ||
192 | z = false; | ||
193 | } else { | ||
194 | try { | ||
195 | String[] split = str.replaceAll("\"|\\]|\\[", "").split(","); | ||
196 | ActivityManager activityManager = (ActivityManager) this.mContext.getSystemService(Context.ACTIVITY_SERVICE); | ||
197 | List<ActivityManager.RunningAppProcessInfo> runningAppProcesses = activityManager.getRunningAppProcesses(); | ||
198 | if (runningAppProcesses == null || split == null) { | ||
199 | Log.d(TAG, "runningPros or pkgNameArray is null."); | ||
200 | z = false; | ||
201 | } else { | ||
202 | String packageName = this.mContext.getPackageName(); | ||
203 | for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : runningAppProcesses) { | ||
204 | boolean z2 = false; | ||
205 | String str2 = runningAppProcessInfo.processName; | ||
206 | int i = runningAppProcessInfo.uid; | ||
207 | boolean persistentFlag = getPersistentFlag(str2); | ||
208 | Log.d(TAG, "running pkgname = " + str2 + ", UID = " + i + ", persistentFlag = " + persistentFlag); | ||
209 | if (TextUtils.isEmpty(packageName) || !packageName.equals(str2)) { | ||
210 | for (String str3 : split) { | ||
211 | if (str2.equals(str3) || persistentFlag) { | ||
212 | Log.d(TAG, "match, remain this app process."); | ||
213 | z2 = true; | ||
214 | break; | ||
215 | } | ||
216 | } | ||
217 | if (!z2) { | ||
218 | Log.d(TAG, "kill task, pkgname = " + str2); | ||
219 | activityManager.killBackgroundProcesses(str2); | ||
220 | } | ||
221 | } else { | ||
222 | Log.d(TAG, "ignore top package process, pkg = " + str2); | ||
223 | } | ||
224 | } | ||
225 | z = true; | ||
226 | Toast.makeText(this.mContext, "clean cache success!", Toast.LENGTH_SHORT).show(); | ||
227 | } | ||
228 | } catch (Exception e) { | ||
229 | e.printStackTrace(); | ||
230 | } | ||
231 | } | ||
232 | return z; | ||
233 | } | ||
234 | |||
235 | public void delInstalledAppFile(String str) { | ||
236 | Log.d(TAG, "delInstalledAppFile appName=" + str); | ||
237 | try { | ||
238 | if (mInstallAppTbl.containsKey(str)) { | ||
239 | String str2 = mInstallAppTbl.get(str); | ||
240 | File file = new File(str2); | ||
241 | if (file.exists()) { | ||
242 | Log.d(TAG, "delInstalledAppFile app Path = " + str2); | ||
243 | if (!file.delete()) { | ||
244 | Log.d(TAG, "delInstalledAppFile delete failed."); | ||
245 | } | ||
246 | mInstallAppTbl.remove(str); | ||
247 | } | ||
248 | } | ||
249 | } catch (Exception e) { | ||
250 | e.printStackTrace(); | ||
251 | } | ||
252 | } | ||
253 | |||
254 | @JavascriptInterface | ||
255 | public int getAppCount() { | ||
256 | int i = 0; | ||
257 | try { | ||
258 | i = this.mContext.getPackageManager().getInstalledPackages(0).size(); | ||
259 | } catch (Exception e) { | ||
260 | e.printStackTrace(); | ||
261 | } | ||
262 | Log.d(TAG, "getAppCount count = " + i); | ||
263 | return i; | ||
264 | } | ||
265 | |||
266 | @JavascriptInterface | ||
267 | public String getAppList(int i, int i2) { | ||
268 | String str; | ||
269 | JSONObject jSONObject = new JSONObject(); | ||
270 | JSONArray jSONArray = new JSONArray(); | ||
271 | try { | ||
272 | jSONObject.put("apps_count", 0); | ||
273 | jSONObject.put("apps", jSONArray); | ||
274 | } catch (Exception e) { | ||
275 | e.printStackTrace(); | ||
276 | } | ||
277 | PackageManager packageManager = this.mContext.getPackageManager(); | ||
278 | List<PackageInfo> installedPackages = packageManager.getInstalledPackages(0); | ||
279 | int size = installedPackages.size(); | ||
280 | if (i > size || i < 0 || i2 <= 0) { | ||
281 | str = jSONObject.toString(); | ||
282 | } else { | ||
283 | Log.d(TAG, "getAppList position = " + i + ", count=" + i2 + ", pkgSize=" + size); | ||
284 | int i3 = i2; | ||
285 | if (size - i < i2) { | ||
286 | i3 = size - i; | ||
287 | } | ||
288 | for (int i4 = 0; i4 < i3; i4++) { | ||
289 | try { | ||
290 | PackageInfo packageInfo = installedPackages.get(i + i4); | ||
291 | if (packageInfo != null) { | ||
292 | JSONObject jSONObject2 = new JSONObject(); | ||
293 | jSONObject2.put("name", (String) packageManager.getApplicationLabel(packageInfo.applicationInfo)); | ||
294 | jSONObject2.put("package", packageInfo.applicationInfo.packageName); | ||
295 | jSONObject2.put("isSystem", (packageInfo.applicationInfo.flags & 1) != 0); | ||
296 | jSONArray.put(jSONObject2); | ||
297 | } | ||
298 | } catch (Exception e2) { | ||
299 | e2.printStackTrace(); | ||
300 | } | ||
301 | } | ||
302 | try { | ||
303 | jSONObject.put("apps_count", i3); | ||
304 | jSONObject.put("apps", jSONArray); | ||
305 | } catch (JSONException e) { | ||
306 | e.printStackTrace(); | ||
307 | } | ||
308 | str = jSONObject.toString(); | ||
309 | Log.d(TAG, "getAppList() appsResult = " + str); | ||
310 | } | ||
311 | return str; | ||
312 | } | ||
313 | |||
314 | @JavascriptInterface | ||
315 | public String getAppVersion(String str) { | ||
316 | String str2 = ""; | ||
317 | Log.d(TAG, "getAppVersion appName = " + str); | ||
318 | if (TextUtils.isEmpty(str)) { | ||
319 | str2 = ""; | ||
320 | } else { | ||
321 | try { | ||
322 | PackageInfo packageInfo = this.mContext.getPackageManager().getPackageInfo(str, 0); | ||
323 | if (packageInfo != null) { | ||
324 | str2 = packageInfo.versionName; | ||
325 | } | ||
326 | Log.d(TAG, "getAppVersion versionName = " + str2); | ||
327 | } catch (Exception e) { | ||
328 | e.printStackTrace(); | ||
329 | str2 = ""; | ||
330 | } | ||
331 | } | ||
332 | return str2; | ||
333 | } | ||
334 | |||
335 | @JavascriptInterface | ||
336 | public int getAppVersionCode(String str) { | ||
337 | int i = -1; | ||
338 | Log.d(TAG, "getAppVersionCode appName = " + str); | ||
339 | if (TextUtils.isEmpty(str)) { | ||
340 | i = -1; | ||
341 | } else { | ||
342 | try { | ||
343 | PackageInfo packageInfo = this.mContext.getPackageManager().getPackageInfo(str, 0); | ||
344 | if (packageInfo != null) { | ||
345 | i = packageInfo.versionCode; | ||
346 | } | ||
347 | Log.d(TAG, "getAppVersionCode versionCode = " + i); | ||
348 | } catch (Exception e) { | ||
349 | e.printStackTrace(); | ||
350 | i = -1; | ||
351 | } | ||
352 | } | ||
353 | return i; | ||
354 | } | ||
355 | |||
356 | @JavascriptInterface | ||
357 | public String getApps() { | ||
358 | Log.d(TAG, "getApps() function in."); | ||
359 | String str = ""; | ||
360 | try { | ||
361 | JSONArray jSONArray = new JSONArray(); | ||
362 | PackageManager packageManager = this.mContext.getPackageManager(); | ||
363 | for (PackageInfo packageInfo : packageManager.getInstalledPackages(0)) { | ||
364 | if ((packageInfo.applicationInfo.flags & 1) == 0) { | ||
365 | Log.d(TAG, "getApps, packageName = " + packageInfo.packageName); | ||
366 | JSONObject jSONObject = new JSONObject(); | ||
367 | jSONObject.put("Version", packageInfo.versionName); | ||
368 | jSONObject.put("appName", (String) packageManager.getApplicationLabel(packageInfo.applicationInfo)); | ||
369 | jSONObject.put("packageName", packageInfo.packageName); | ||
370 | jSONArray.put(jSONObject); | ||
371 | } | ||
372 | } | ||
373 | String jSONArray2 = jSONArray.toString(); | ||
374 | str = jSONArray2; | ||
375 | Log.d(TAG, "getApps, appInfos = " + jSONArray2); | ||
376 | str = jSONArray2; | ||
377 | } catch (Exception e) { | ||
378 | e.printStackTrace(); | ||
379 | } | ||
380 | return str; | ||
381 | } | ||
382 | |||
383 | @JavascriptInterface | ||
384 | public void installApp(String str) { | ||
385 | Log.d(TAG, "installApp downloadUrl= " + str); | ||
386 | if (!TextUtils.isEmpty(str)) { | ||
387 | FHFileTool.clearDirFiles(SAVED_FILE_PATH); | ||
388 | FHDownLoadManager instance = FHDownLoadManager.getInstance(); | ||
389 | try { | ||
390 | if (str.startsWith("http://") || str.startsWith("https://")) { | ||
391 | if (instance.syncDownloadFile(str, SAVED_FILE_PATH, true, true, "application/vnd.android.package-archive", null, false) != 1) { | ||
392 | Log.d(TAG, "installApp download apk file failed, URL=" + str); | ||
393 | return; | ||
394 | } | ||
395 | } else if (!FHFileTool.openFile(this.mContext, str, "application/vnd.android.package-archive")) { | ||
396 | Log.d(TAG, "installApp open apk file failed, URL=" + str); | ||
397 | return; | ||
398 | } | ||
399 | String fileNameFromUrl = FHFileTool.getFileNameFromUrl(str); | ||
400 | String genSavedFileFullPath = FHDownLoadManager.genSavedFileFullPath(str, SAVED_FILE_PATH); | ||
401 | if (!TextUtils.isEmpty(fileNameFromUrl)) { | ||
402 | String parseAppFile = FHActivityUtil.parseAppFile(this.mContext, genSavedFileFullPath); | ||
403 | Log.d(TAG, "installApp pkgName=" + parseAppFile + ", savedFullPath=" + genSavedFileFullPath); | ||
404 | mInstallAppTbl.put(parseAppFile, genSavedFileFullPath); | ||
405 | return; | ||
406 | } | ||
407 | return; | ||
408 | } catch (Exception e) { | ||
409 | e.printStackTrace(); | ||
410 | } | ||
411 | } | ||
412 | } | ||
413 | |||
414 | @JavascriptInterface | ||
415 | public boolean isAppInstalled(String str) { | ||
416 | boolean z = false; | ||
417 | Log.d(TAG, "isAppInstalled appName = " + str); | ||
418 | if (!TextUtils.isEmpty(str)) { | ||
419 | if (str.equals("com.android.settings")) { | ||
420 | Log.d(TAG, "isAppInstalled com.android.settings will call FHSettings."); | ||
421 | z = true; | ||
422 | } else { | ||
423 | z = false; | ||
424 | try { | ||
425 | if (this.mContext.getPackageManager().getApplicationInfo(str, 0) != null) { | ||
426 | Log.d(TAG, "isAppInstalled: app installed."); | ||
427 | z = true; | ||
428 | } | ||
429 | } catch (Exception e) { | ||
430 | e.printStackTrace(); | ||
431 | z = false; | ||
432 | } | ||
433 | } | ||
434 | } | ||
435 | return z; | ||
436 | } | ||
437 | |||
438 | @JavascriptInterface | ||
439 | public int isAppInstalledByVersion(String str, int i) { | ||
440 | int i2 = -1; | ||
441 | if (TextUtils.isEmpty(str)) { | ||
442 | i2 = -1; | ||
443 | } else { | ||
444 | try { | ||
445 | PackageInfo packageInfo = this.mContext.getPackageManager().getPackageInfo(str, 0); | ||
446 | if (packageInfo == null) { | ||
447 | Log.d(TAG, "isAppInstalledByVersion " + str + " is not installed."); | ||
448 | i2 = -1; | ||
449 | } else { | ||
450 | Log.d(TAG, "isAppInstalledByVersion " + str + " versionCode= " + packageInfo.versionCode); | ||
451 | i2 = packageInfo.versionCode == i ? 0 : 1; | ||
452 | } | ||
453 | } catch (Exception e) { | ||
454 | e.printStackTrace(); | ||
455 | } | ||
456 | } | ||
457 | return i2; | ||
458 | } | ||
459 | |||
460 | @JavascriptInterface | ||
461 | public void restartAppByName(String str) { | ||
462 | Log.d(TAG, "restartAppByName appName = " + str); | ||
463 | if (!TextUtils.isEmpty(str)) { | ||
464 | try { | ||
465 | ActivityManager activityManager = ((ActivityManager) this.mContext.getSystemService(Context.ACTIVITY_SERVICE)); | ||
466 | Method method = Class.forName("android.app.ActivityManager").getMethod("forceStopPackage", String.class); | ||
467 | method.invoke(activityManager, str); | ||
468 | } catch (Exception e) { | ||
469 | e.printStackTrace(); | ||
470 | } | ||
471 | startAppByName(str); | ||
472 | } | ||
473 | } | ||
474 | |||
475 | @JavascriptInterface | ||
476 | public void sendBroadcastByIntent(String str) { | ||
477 | Log.d(TAG, "sendBroadcastByIntent intentMessage = " + str); | ||
478 | startBroadcastByIntent(str); | ||
479 | } | ||
480 | |||
481 | @JavascriptInterface | ||
482 | public void startActivityByIntent(String str) { | ||
483 | startAppByIntent(str); | ||
484 | } | ||
485 | |||
486 | @JavascriptInterface | ||
487 | public void startAppByIntent(String str) { | ||
488 | Intent parseIntentMessage; | ||
489 | Log.d(TAG, "startAppByIntent intentMessage = " + str); | ||
490 | if (!TextUtils.isEmpty(str) && (parseIntentMessage = parseIntentMessage(str, 1)) != null) { | ||
491 | try { | ||
492 | this.mContext.startActivity(parseIntentMessage); | ||
493 | } catch (Exception e) { | ||
494 | e.printStackTrace(); | ||
495 | } | ||
496 | } | ||
497 | } | ||
498 | |||
499 | @JavascriptInterface | ||
500 | public void startAppByName(String str) { | ||
501 | if (!TextUtils.isEmpty(str)) { | ||
502 | Log.d(TAG, "startAppByName appName = " + str); | ||
503 | if (str.equals("com.android.settings")) { | ||
504 | Intent intent = new Intent("fiberhome.intent.action.FHSETTINGS"); | ||
505 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
506 | try { | ||
507 | this.mContext.startActivity(intent); | ||
508 | } | ||
509 | catch(Exception e) { | ||
510 | e.printStackTrace(); | ||
511 | } | ||
512 | return; | ||
513 | } | ||
514 | try { | ||
515 | Intent launchIntentForPackage = this.mContext.getPackageManager().getLaunchIntentForPackage(str); | ||
516 | if (launchIntentForPackage != null) { | ||
517 | this.mContext.startActivity(launchIntentForPackage); | ||
518 | } | ||
519 | } catch (Exception e) { | ||
520 | e.printStackTrace(); | ||
521 | } | ||
522 | } | ||
523 | } | ||
524 | |||
525 | @JavascriptInterface | ||
526 | public void startBroadcastByIntent(String str) { | ||
527 | Intent parseIntentMessage; | ||
528 | Log.d(TAG, "startBroadcastByIntent intentMessage = " + str); | ||
529 | if (!TextUtils.isEmpty(str) && (parseIntentMessage = parseIntentMessage(str, 2)) != null) { | ||
530 | try { | ||
531 | this.mContext.sendBroadcast(parseIntentMessage); | ||
532 | } catch (Exception e) { | ||
533 | e.printStackTrace(); | ||
534 | } | ||
535 | } | ||
536 | } | ||
537 | |||
538 | @JavascriptInterface | ||
539 | public void startLauncherByIntent() { | ||
540 | Log.e(TAG,"startLauncherByIntent is not support!"); | ||
541 | } | ||
542 | |||
543 | @JavascriptInterface | ||
544 | public void startService(String str) { | ||
545 | Log.d(TAG, "startService intentMessage = " + str); | ||
546 | Intent parseIntentMessage = parseIntentMessage(str, 2); | ||
547 | if (parseIntentMessage != null) { | ||
548 | try { | ||
549 | this.mContext.startService(parseIntentMessage); | ||
550 | } catch (Exception e) { | ||
551 | e.printStackTrace(); | ||
552 | } | ||
553 | } | ||
554 | } | ||
555 | |||
556 | @JavascriptInterface | ||
557 | public boolean unInstallApp(String str) { | ||
558 | boolean z = false; | ||
559 | Log.d(TAG, "unInstallApp() appName = " + str); | ||
560 | if (TextUtils.isEmpty(str)) { | ||
561 | z = false; | ||
562 | } else { | ||
563 | try { | ||
564 | this.mContext.startActivity(new Intent("android.intent.action.DELETE", Uri.parse("package:" + str))); | ||
565 | z = true; | ||
566 | } catch (Exception e) { | ||
567 | e.printStackTrace(); | ||
568 | } | ||
569 | } | ||
570 | return z; | ||
571 | } | ||
572 | |||
573 | @JavascriptInterface | ||
574 | public boolean uninstallApp(String str) { | ||
575 | return unInstallApp(str); | ||
576 | } | ||
577 | } |
1 | package com.topdraw.iptvlaunchertest.fh; | ||
2 | |||
3 | public class Util { | ||
4 | public static String byte2Hex(byte[] bArr) { | ||
5 | String str; | ||
6 | String str2 = ""; | ||
7 | if (bArr == null || bArr.length == 0) { | ||
8 | str = null; | ||
9 | } else { | ||
10 | for (int i = 0; i < bArr.length; i++) { | ||
11 | String hexString = Integer.toHexString(bArr[i] & 255); | ||
12 | String str3 = hexString.length() == 1 ? str2 + "0" + hexString : str2 + hexString; | ||
13 | str2 = str3; | ||
14 | if (i < bArr.length - 1) { | ||
15 | str2 = str3 + ""; | ||
16 | } | ||
17 | } | ||
18 | str = str2.toUpperCase(); | ||
19 | } | ||
20 | return str; | ||
21 | } | ||
22 | |||
23 | public static String strLeftPad(String str, int i, char c) { | ||
24 | String str2; | ||
25 | if (str == null) { | ||
26 | str2 = null; | ||
27 | } else { | ||
28 | int length = i - str.length(); | ||
29 | str2 = str; | ||
30 | if (length > 0) { | ||
31 | char[] cArr = new char[length]; | ||
32 | for (int i2 = 0; i2 < cArr.length; i2++) { | ||
33 | cArr[i2] = c; | ||
34 | } | ||
35 | str2 = new String(cArr).concat(str); | ||
36 | } | ||
37 | } | ||
38 | return str2; | ||
39 | } | ||
40 | } |
1 | package com.topdraw.iptvlaunchertest; | 1 | package com.topdraw.iptvlaunchertest.sky; |
2 | 2 | ||
3 | import android.content.Context; | 3 | import android.content.Context; |
4 | import android.content.pm.PackageInfo; | 4 | import android.content.pm.PackageInfo; |
5 | import android.content.pm.PackageManager; | 5 | import android.content.pm.PackageManager; |
6 | import android.os.Build; | 6 | import android.os.Build; |
7 | import android.util.Log; | 7 | import android.util.Log; |
8 | |||
9 | import com.topdraw.iptvlaunchertest.App; | ||
10 | import com.topdraw.iptvlaunchertest.BuildConfig; | ||
11 | |||
8 | import java.io.BufferedReader; | 12 | import java.io.BufferedReader; |
9 | import java.io.IOException; | 13 | import java.io.IOException; |
10 | import java.io.InputStream; | 14 | import java.io.InputStream; | ... | ... |
1 | package com.topdraw.iptvlaunchertest; | 1 | package com.topdraw.iptvlaunchertest.sky; |
2 | 2 | ||
3 | import android.annotation.TargetApi; | 3 | import android.annotation.TargetApi; |
4 | import android.app.PendingIntent; | 4 | import android.app.PendingIntent; |
5 | import android.content.Intent; | 5 | import android.content.Intent; |
6 | import android.content.pm.PackageInstaller; | 6 | import android.content.pm.PackageInstaller; |
7 | |||
8 | import com.topdraw.iptvlaunchertest.App; | ||
9 | |||
7 | import java.io.File; | 10 | import java.io.File; |
8 | import java.io.FileInputStream; | 11 | import java.io.FileInputStream; |
9 | import java.io.IOException; | 12 | import java.io.IOException; | ... | ... |
... | @@ -3,7 +3,7 @@ agp = "8.6.1" | ... | @@ -3,7 +3,7 @@ agp = "8.6.1" |
3 | junit = "4.13.2" | 3 | junit = "4.13.2" |
4 | junitVersion = "1.2.1" | 4 | junitVersion = "1.2.1" |
5 | espressoCore = "3.6.1" | 5 | espressoCore = "3.6.1" |
6 | appcompat = "1.7.0" | 6 | appcompat = "1.2.0" |
7 | material = "1.12.0" | 7 | material = "1.12.0" |
8 | activity = "1.9.1" | 8 | activity = "1.9.1" |
9 | constraintlayout = "2.1.4" | 9 | constraintlayout = "2.1.4" | ... | ... |
-
Please register or sign in to post a comment