From 7021ada78f65c5de585a1b6e629b82603872ed9a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 1 Nov 2013 01:47:20 +0100 Subject: [PATCH] (Android) Add GPL license waiver dialog box - text will need further refinement --- android/phoenix/res/values/strings.xml | 2 ++ .../retroarch/browser/MainMenuActivity.java | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/android/phoenix/res/values/strings.xml b/android/phoenix/res/values/strings.xml index dc2a3417c5..872204628b 100644 --- a/android/phoenix/res/values/strings.xml +++ b/android/phoenix/res/values/strings.xml @@ -50,6 +50,8 @@ No core Welcome to RetroArch This is your first time starting up RetroArch. RetroArch will now be preconfigured for the best possible gameplay experience. + GPL waiver + Copyright (C) 2010-2013 RetroArch Team.\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with this program; if not, see www.gnu.org/licenses.\n\nAdditional permission under GNU GPL version 3 section 7\n\nIf you modify this Program, or any covered work, by linking or combining it with [name of library] (or a modified version of that library), containing parts covered by the terms of [name of library\'s license], the licensors of this Program grant you additional permission to convey the resulting work. {Corresponding Source for a non-source form of such a combination shall include the source code for the parts of [name of library] used as well as that of the covered work.} The ideal configuration options for your device will now be preconfigured.\n\nNOTE: For optimal performance, turn off Google Account sync, GPS and Wi-Fi in your Android settings menu. The ideal configuration options for your device will now be preconfigured.\n\nNOTE: For optimal performance, turn off Google Account sync, Google Play Store auto-updates, GPS and Wi-Fi in your Android settings menu. NVidia Shield detected diff --git a/android/phoenix/src/com/retroarch/browser/MainMenuActivity.java b/android/phoenix/src/com/retroarch/browser/MainMenuActivity.java index 72e07f6c8e..94db85a519 100644 --- a/android/phoenix/src/com/retroarch/browser/MainMenuActivity.java +++ b/android/phoenix/src/com/retroarch/browser/MainMenuActivity.java @@ -28,6 +28,33 @@ public final class MainMenuActivity extends PreferenceActivity { private static final String TAG = "MainMenu"; private static String libretro_path; private static String libretro_name; + + private void showGPLWaiver() { + AlertDialog.Builder alert = new AlertDialog.Builder(this) + .setTitle(R.string.gpl_waiver) + .setMessage(R.string.gpl_waiver_desc) + .setPositiveButton("Keep", null) + .setNegativeButton("Remove non-GPL cores", + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + final File[] libs = new File(getApplicationInfo().dataDir, "/cores").listFiles(); + for (final File lib : libs) { + ModuleWrapper module = new ModuleWrapper(getApplicationContext(), lib); + + boolean gplv3 = module.getCoreLicense().equals("GPLv3"); + boolean gplv2 = module.getCoreLicense().equals("GPLv2"); + + if (!gplv3 && !gplv2) { + String libName = lib.getName(); + Log.i("GPL WAIVER", "Deleting non-GPL core" + libName + "..."); + lib.delete(); + } + } + } + }); + alert.show(); + } @Override @SuppressWarnings("deprecation") @@ -61,6 +88,8 @@ public final class MainMenuActivity extends PreferenceActivity { .setPositiveButton("OK", null); alert.show(); } + + showGPLWaiver(); } Intent startedByIntent = getIntent();