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

Commit 64de610f authored by Roman Birg's avatar Roman Birg Committed by LuK1337
Browse files

Settings: Add LineageOS legal info



Open up the LineageOS legal info in the browser.

Change-Id: I263ccc0509e275d17512528deb606341d58e7a0d
Ticket-Id: CYNGNOS-1895
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent e66ea91f
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2012-2016 The CyanogenMod Project
     Copyright (C) 2017-2019 The LineageOS Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <!-- Device Info screen. LineageOS legal. -->
    <string name="lineagelicense_title">LineageOS legal</string>
</resources>
+5 −0
Original line number Diff line number Diff line
@@ -36,6 +36,11 @@
        android:title="@string/license_title"
        settings:controller="com.android.settings.deviceinfo.legal.LicensePreferenceController" />

    <!-- Lineage License information -->
    <PreferenceScreen
        android:key="lineagelicense"
        android:title="@string/lineagelicense_title" />

    <!-- Terms and conditions -->
    <Preference
        android:key="terms"
+24 −0
Original line number Diff line number Diff line
@@ -18,7 +18,12 @@ package com.android.settings;

import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.SystemProperties;
import android.provider.SearchIndexableResource;
import android.util.Log;
import androidx.preference.Preference;

import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
@@ -33,6 +38,9 @@ public class LegalSettings extends DashboardFragment {

    private static final String TAG = "LegalSettings";

    private static final String PROPERTY_LINEAGELICENSE_URL = "ro.lineagelegal.url";
    private static final String KEY_LINEAGE_LICENSE = "lineagelicense";

    @Override
    public int getMetricsCategory() {
        return SettingsEnums.ABOUT_LEGAL_SETTINGS;
@@ -43,6 +51,22 @@ public class LegalSettings extends DashboardFragment {
        return TAG;
    }

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

    @Override
    protected int getPreferenceScreenResId() {
        return R.xml.about_legal;