Merge branch '1089-whitelabel-applicationid' into 'master'

Remove dependence on "org.fdroid.fdroid" to make whitelabel clients easier

Closes #1089

See merge request fdroid/fdroidclient!614
This commit is contained in:
Hans-Christoph Steiner 2017-11-22 22:55:11 +00:00
commit 4265b45f18
9 changed files with 29 additions and 21 deletions

View File

@ -224,6 +224,8 @@ android {
defaultConfig {
versionCode 1001000
versionName getVersionName()
applicationId 'org.fdroid.fdroid'
resValue "string", "applicationId", applicationId
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

View File

@ -63,53 +63,53 @@
>
<provider
android:authorities="org.fdroid.fdroid.data.AppProvider"
android:authorities="${applicationId}.data.AppProvider"
android:name="org.fdroid.fdroid.data.AppProvider"
android:exported="false"/>
<provider
android:authorities="org.fdroid.fdroid.data.RepoProvider"
android:authorities="${applicationId}.data.RepoProvider"
android:name="org.fdroid.fdroid.data.RepoProvider"
android:exported="false"/>
<provider
android:authorities="org.fdroid.fdroid.data.ApkProvider"
android:authorities="${applicationId}.data.ApkProvider"
android:name="org.fdroid.fdroid.data.ApkProvider"
android:exported="false"/>
<provider
android:authorities="org.fdroid.fdroid.data.TempApkProvider"
android:authorities="${applicationId}.data.TempApkProvider"
android:name="org.fdroid.fdroid.data.TempApkProvider"
android:exported="false"/>
<provider
android:authorities="org.fdroid.fdroid.data.TempAppProvider"
android:authorities="${applicationId}.data.TempAppProvider"
android:name="org.fdroid.fdroid.data.TempAppProvider"
android:exported="false"/>
<provider
android:authorities="org.fdroid.fdroid.data.InstalledAppProvider"
android:authorities="${applicationId}.data.InstalledAppProvider"
android:name="org.fdroid.fdroid.data.InstalledAppProvider"
android:exported="false"/>
<provider
android:authorities="org.fdroid.fdroid.data.AppPrefsProvider"
android:authorities="${applicationId}.data.AppPrefsProvider"
android:name="org.fdroid.fdroid.data.AppPrefsProvider"
android:exported="false"/>
<provider
android:authorities="org.fdroid.fdroid.data.PackageProvider"
android:authorities="${applicationId}.data.PackageProvider"
android:name="org.fdroid.fdroid.data.PackageProvider"
android:exported="false"/>
<provider
android:authorities="org.fdroid.fdroid.data.CategoryProvider"
android:authorities="${applicationId}.data.CategoryProvider"
android:name="org.fdroid.fdroid.data.CategoryProvider"
android:exported="false"/>
<provider
android:name="org.fdroid.fdroid.installer.ApkFileProvider"
android:authorities="org.fdroid.fdroid.installer.ApkFileProvider"
android:authorities="${applicationId}.installer.ApkFileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
@ -118,7 +118,7 @@
</provider>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="org.fdroid.fdroid.installer"
android:authorities="${applicationId}.installer"
android:exported="false"
android:grantUriPermissions="true">
<meta-data

View File

@ -81,6 +81,7 @@ import sun.net.www.protocol.bluetooth.Handler;
public class FDroidApp extends Application {
private static final String TAG = "FDroidApp";
private static final String ACRA_ID = BuildConfig.APPLICATION_ID + ":acra";
public static final String SYSTEM_DIR_NAME = Environment.getRootDirectory().getAbsolutePath();
@ -425,7 +426,7 @@ public class FDroidApp extends Application {
int pid = android.os.Process.myPid();
for (RunningAppProcessInfo processInfo : processes) {
if (processInfo.pid == pid && "org.fdroid.fdroid:acra".equals(processInfo.processName)) {
if (processInfo.pid == pid && ACRA_ID.equals(processInfo.processName)) {
return true;
}
}

View File

@ -6,6 +6,7 @@ import android.content.pm.PackageManager;
import android.os.Build;
import android.util.Log;
import org.fdroid.fdroid.BuildConfig;
import org.fdroid.fdroid.Utils;
import org.fdroid.fdroid.installer.PrivilegedInstaller;
@ -34,7 +35,7 @@ public class PackageManagerCompat {
if (Build.VERSION.SDK_INT >= 24 && PrivilegedInstaller.isDefault(context)) {
mPm.setInstallerPackageName(packageName, "org.fdroid.fdroid.privileged");
} else {
mPm.setInstallerPackageName(packageName, "org.fdroid.fdroid");
mPm.setInstallerPackageName(packageName, BuildConfig.APPLICATION_ID);
}
Utils.debugLog(TAG, "Installer package name for " + packageName + " set successfully");
} catch (SecurityException | IllegalArgumentException e) {

View File

@ -13,6 +13,7 @@ import android.net.Uri;
import android.os.Build;
import android.support.annotation.NonNull;
import org.fdroid.fdroid.BuildConfig;
import org.fdroid.fdroid.Utils;
import java.util.ArrayList;
@ -24,7 +25,7 @@ public abstract class FDroidProvider extends ContentProvider {
private static final String TAG = "FDroidProvider";
static final String AUTHORITY = "org.fdroid.fdroid.data";
static final String AUTHORITY = BuildConfig.APPLICATION_ID + ".data";
static final int CODE_LIST = 1;
static final int CODE_SINGLE = 2;

View File

@ -26,6 +26,7 @@ import android.net.Uri;
import android.os.Build;
import android.support.v4.content.FileProvider;
import org.fdroid.fdroid.BuildConfig;
import org.fdroid.fdroid.data.Apk;
import org.fdroid.fdroid.data.SanitizedFile;
@ -47,7 +48,7 @@ import java.io.IOException;
*/
public class ApkFileProvider extends FileProvider {
private static final String AUTHORITY = "org.fdroid.fdroid.installer.ApkFileProvider";
private static final String AUTHORITY = BuildConfig.APPLICATION_ID + ".installer.ApkFileProvider";
public static Uri getSafeUri(Context context, PackageInfo packageInfo) throws IOException {
SanitizedFile tempApkFile = ApkCache.copyInstalledApkToFiles(context, packageInfo);

View File

@ -40,6 +40,7 @@ import android.widget.Toast;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import org.fdroid.fdroid.BuildConfig;
import org.fdroid.fdroid.R;
import org.fdroid.fdroid.UpdateService;
import org.fdroid.fdroid.Utils;
@ -133,7 +134,7 @@ public class SwapAppsView extends ListView implements
private void pollForUpdates() {
if (adapter.getCount() > 1 ||
(adapter.getCount() == 1 && !new App((Cursor) adapter.getItem(0)).packageName.equals("org.fdroid.fdroid"))) { // NOCHECKSTYLE LineLength
(adapter.getCount() == 1 && !new App((Cursor) adapter.getItem(0)).packageName.equals(BuildConfig.APPLICATION_ID))) { // NOCHECKSTYLE LineLength
Utils.debugLog(TAG, "Not polling for new apps from swap repo, because we already have more than one.");
return;
}

View File

@ -33,6 +33,7 @@ import android.widget.Toast;
import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult;
import org.fdroid.fdroid.BuildConfig;
import org.fdroid.fdroid.FDroidApp;
import org.fdroid.fdroid.NfcHelper;
import org.fdroid.fdroid.Preferences;
@ -433,7 +434,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
}
private void sendFDroidApk() {
((FDroidApp) getApplication()).sendViaBluetooth(this, Activity.RESULT_OK, "org.fdroid.fdroid");
((FDroidApp) getApplication()).sendViaBluetooth(this, Activity.RESULT_OK, BuildConfig.APPLICATION_ID);
}
// TODO: Figure out whether they have changed since last time UpdateAsyncTask was run.
@ -632,7 +633,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
class PrepareInitialSwapRepo extends PrepareSwapRepo {
PrepareInitialSwapRepo() {
super(new HashSet<>(Arrays.asList(new String[] {"org.fdroid.fdroid"})));
super(new HashSet<>(Arrays.asList(new String[] {BuildConfig.APPLICATION_ID})));
}
}

View File

@ -3,14 +3,14 @@
<PreferenceScreen android:title="@string/about_title">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="org.fdroid.fdroid"
android:targetPackage="@string/applicationId"
android:targetClass="org.fdroid.fdroid.AboutActivity" />
</PreferenceScreen>
<PreferenceCategory android:title="@string/preference_category__my_apps">
<PreferenceScreen android:title="@string/preference_manage_installed_apps">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="org.fdroid.fdroid"
android:targetPackage="@string/applicationId"
android:targetClass="org.fdroid.fdroid.views.installed.InstalledAppsActivity" />
</PreferenceScreen>
<PreferenceScreen
@ -18,7 +18,7 @@
android:summary="@string/repositories_summary">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="org.fdroid.fdroid"
android:targetPackage="@string/applicationId"
android:targetClass="org.fdroid.fdroid.views.ManageReposActivity" />
</PreferenceScreen>
</PreferenceCategory>