Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5614e2fb authored by Roman Birg's avatar Roman Birg Committed by Abhisek Devkota
Browse files

Settings: fix 'CyanogenMod legal' link



No more WebViews in priv-apps, so open it up in the browser.

CYNGNOS-1895

Change-Id: I263ccc0509e275d17512528deb606341d58e7a0d
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent 994fb0bf
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1139,4 +1139,7 @@

    <string name="interruptions_ignore_while_media_title">Prevent audio ducking</string>
    <string name="interruptions_ignore_while_media_summary">Do not reduce media playback volume when a notification arrives</string>

    <!-- CM Legal -->
    <string name="cmlicense_title">CyanogenMod legal</string>
</resources>
+5 −0
Original line number Diff line number Diff line
@@ -36,6 +36,11 @@
        <intent android:action="android.settings.LICENSE" />
    </PreferenceScreen>

    <!-- CM License information -->
    <PreferenceScreen
        android:key="cmlicense"
        android:title="@string/cmlicense_title" />

    <!-- Terms and conditions -->
    <PreferenceScreen
        android:key="terms"
+24 −0
Original line number Diff line number Diff line
@@ -22,9 +22,14 @@ import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import android.os.SystemProperties;
import android.preference.Preference;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.provider.SearchIndexableResource;
import android.util.Log;

import com.android.internal.logging.MetricsLogger;
import com.android.settings.search.BaseSearchIndexProvider;
@@ -36,10 +41,13 @@ import java.util.List;

public class LegalSettings extends SettingsPreferenceFragment implements Indexable {

    private static final String LOG_TAG = "LegalSettings";
    private static final String KEY_TERMS = "terms";
    private static final String KEY_LICENSE = "license";
    private static final String KEY_COPYRIGHT = "copyright";
    private static final String KEY_WEBVIEW_LICENSE = "webview_license";
    private static final String PROPERTY_CMLICENSE_URL = "ro.cmlegal.url";
    private static final String KEY_CM_LICENSE = "cmlicense";

    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
@@ -58,6 +66,22 @@ public class LegalSettings extends SettingsPreferenceFragment implements Indexab
                Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
    }

    @Override
    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
        if (preference.getKey().equals(KEY_CM_LICENSE)) {
            String userCMLicenseUrl = SystemProperties.get(PROPERTY_CMLICENSE_URL);
            final Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.addCategory(Intent.CATEGORY_DEFAULT);
            intent.setData(Uri.parse(userCMLicenseUrl));
            try {
                startActivity(intent);
            } catch (Exception e) {
                Log.e(LOG_TAG, "Unable to start activity " + intent.toString());
            }
        }
        return super.onPreferenceTreeClick(preferenceScreen, preference);
    }

    @Override
    protected int getMetricsCategory() {
        return MetricsLogger.ABOUT_LEGAL_SETTINGS;