diff options
author | fuzzard <fuzzard@users.noreply.github.com> | 2023-03-17 17:45:56 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-17 17:45:56 +1000 |
commit | f23e3d305c8e096654100450546c8365e80c7e9b (patch) | |
tree | edb77f86a905cf771d222af8abd8004d8351fa32 /tools/android | |
parent | 243815af162ac454201a181a5e0281010631dba6 (diff) | |
parent | 91f7689b7783ed10137fd4e607271e97ffaef59c (diff) |
Merge pull request #22988 from joseluismarti/remove-obb
[Android] Remove OBB expansion files
Diffstat (limited to 'tools/android')
-rw-r--r-- | tools/android/packaging/Makefile.in | 11 | ||||
-rw-r--r-- | tools/android/packaging/xbmc/src/Splash.java.in | 171 |
2 files changed, 4 insertions, 178 deletions
diff --git a/tools/android/packaging/Makefile.in b/tools/android/packaging/Makefile.in index 5111f1ecd2..2b82c8d780 100644 --- a/tools/android/packaging/Makefile.in +++ b/tools/android/packaging/Makefile.in @@ -38,10 +38,6 @@ all: apk apk: apk-clean sharedapk package -obb: apk-clean sharedobb - -apk-obb: apk-clean sharedobb package - xbmc/assets: mkdir -p xbmc/assets @@ -58,11 +54,6 @@ shared: sharedapk: shared | xbmc/assets cp -rfp assets/* ./xbmc/assets -sharedobb: shared - rm -f $(CMAKE_SOURCE_DIR)/main.@APP_NAME_LC@.obb - $(ZIP) -9 -q -r $(CMAKE_SOURCE_DIR)/main.@APP_NAME_LC@.obb assets - @echo "$(CMAKE_SOURCE_DIR)/main.@APP_NAME_LC@.obb created" - python: | xbmc/assets mkdir -p xbmc/assets/python@PYTHON_VERSION@/lib/ cp -rfp $(PREFIX)/lib/python@PYTHON_VERSION@ xbmc/assets/python@PYTHON_VERSION@/lib/ @@ -129,5 +120,5 @@ apk-clean: rm -f xbmc/res/drawable-xxxhdpi/splash.* rm -rf assets -.PHONY: force libs assets python sharedapk sharedobb res package +.PHONY: force libs assets python sharedapk res package diff --git a/tools/android/packaging/xbmc/src/Splash.java.in b/tools/android/packaging/xbmc/src/Splash.java.in index bf4b32ada0..a58f744610 100644 --- a/tools/android/packaging/xbmc/src/Splash.java.in +++ b/tools/android/packaging/xbmc/src/Splash.java.in @@ -39,8 +39,6 @@ import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.lang.System; -import java.net.HttpURLConnection; -import java.net.URL; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; @@ -67,8 +65,6 @@ public class Splash extends Activity private static final int CheckingPermissionsInfo = 11; private static final int CheckExternalStorage = 12; private static final int RecordAudioPermission = 13; - private static final int DownloadingObb = 90; - private static final int DownloadObbDone = 91; private static final int StartingXBMC = 99; private static final String TAG = "@APP_NAME@"; @@ -180,11 +176,6 @@ public class Splash extends Activity mSplash.mTextView.setText("Clearing cache..."); mSplash.mProgress.setVisibility(View.INVISIBLE); break; - case DownloadingObb: - break; - case DownloadObbDone: - new FillCache(mSplash).execute(); - break; case Caching: if (!mCachingDone) new FillCache(mSplash).execute(); @@ -252,136 +243,6 @@ public class Splash extends Activity private StateMachine mStateMachine = new StateMachine(this); - private class DownloadObb extends AsyncTask<String, Integer, Integer> - { - private Splash mSplash = null; - private int mProgressStatus = 0; - - public DownloadObb(Splash splash) - { - this.mSplash = splash; - } - - @Override - protected Integer doInBackground(String... sUrl) - { - InputStream input = null; - OutputStream output = null; - HttpURLConnection connection = null; - - String src = sUrl[0]; - String dest = sUrl[1]; - File fObb = new File(dest); - - Log.d(TAG, "Downloading " + src + " to " + dest); - - if (!fObb.getParentFile().exists() && !fObb.getParentFile().mkdirs()) - { - Log.e(TAG, "Error creating directory " + fObb.getParentFile().getAbsolutePath()); - return -1; - } - - int ret = 0; - try - { - URL url = new URL(src); - connection = (HttpURLConnection) url.openConnection(); - connection.connect(); - - // expect HTTP 200 OK, so we don't mistakenly save error report - // instead of the file - if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) - { - return -1; - } - - // this will be useful to display download percentage - // might be -1: server did not report the length - int fileLength = connection.getContentLength(); - - // download the file - input = connection.getInputStream(); - output = new FileOutputStream(dest); - - byte data[] = new byte[4096]; - long total = 0; - int count; - mProgress.setProgress(0); - mProgress.setMax(fileLength); - while ((count = input.read(data)) != -1) - { - // allow canceling with back button - if (isCancelled()) - { - ret = -1; - break; - } - total += count; - // publishing the progress.... - if (fileLength > 0) // only if total length is known - publishProgress((int) total); - output.write(data, 0, count); - } - } - catch (Exception e) - { - return -1; - } - finally - { - try - { - if (output != null) - output.close(); - if (input != null) - input.close(); - } - catch (IOException ignored) - { - } - - if (connection != null) - connection.disconnect(); - } - if (ret == 0) - mState = DownloadObbDone; - else - fObb.delete(); - - publishProgress(0); - return ret; - } - - @Override - protected void onProgressUpdate(Integer... values) - { - switch (mState) - { - case DownloadingObb: - mSplash.mTextView.setText("Downloading OBB..."); - mSplash.mProgress.setVisibility(View.VISIBLE); - mSplash.mProgress.setProgress(values[0]); - break; - case DownloadObbDone: - mSplash.mProgress.setVisibility(View.INVISIBLE); - break; - } - } - - @Override - protected void onPostExecute(Integer result) - { - super.onPostExecute(result); - if (result < 0) - { - mState = InError; - mErrorMsg = "Cannot download obb."; - } - - mStateMachine.sendEmptyMessage(mState); - } - } - private class FillCache extends AsyncTask<Void, Integer, Integer> { @@ -651,32 +512,6 @@ public class Splash extends Activity sPackagePath = getPackageResourcePath(); fPackagePath = new File(sPackagePath); - String obbfn = ""; - if (fPackagePath.length() < 50 * 1024 * 1024) - { - sPackagePath = XBMCProperties.getStringProperty("@APP_NAME_LC@.obb", ""); - if (sPackagePath.equals("")) - { - try - { - obbfn = "main." + getPackageManager().getPackageInfo(getPackageName(), 0).versionCode + "." + getPackageName() + ".obb"; - sPackagePath = Environment.getExternalStorageDirectory() - + "/Android/obb/" + getPackageName() + "/" + obbfn; - } - catch (Exception e) - { - } - } - - fPackagePath = new File(sPackagePath); - if (fPackagePath.length() < 10 * 1024 * 1024) - fPackagePath.delete(); // borked download - if (!fPackagePath.exists()) - { - mState = DownloadingObb; - new DownloadObb(this).execute("http://mirrors.@APP_NAME_LC@.tv/releases/android/obb/" + obbfn, sPackagePath); - } - } } private boolean ParseCpuFeature() @@ -982,7 +817,7 @@ public class Splash extends Activity SetupEnvironment(); - if ((mState != DownloadingObb && mState != InError) && fXbmcHome.exists() && fXbmcHome.lastModified() >= fPackagePath.lastModified() && !mInstallLibs) + if (mState != InError && fXbmcHome.exists() && fXbmcHome.lastModified() >= fPackagePath.lastModified() && !mInstallLibs) { mState = CachingDone; mCachingDone = true; @@ -990,7 +825,7 @@ public class Splash extends Activity } } - if ((mState != DownloadingObb && mState != InError) && mCachingDone && mExternalStorageChecked && mPermissionOK) + if (mState != InError && mCachingDone && mExternalStorageChecked && mPermissionOK) { startXBMC(); return; @@ -1000,7 +835,7 @@ public class Splash extends Activity mProgress = (ProgressBar) findViewById(R.id.progressBar1); mTextView = (TextView) findViewById(R.id.textView1); - if (mState == DownloadingObb || mState == InError || mState == CheckingPermissionsInfo) + if (mState == InError || mState == CheckingPermissionsInfo) { mStateMachine.sendEmptyMessage(mState); return; |