Added a module licenses option that lives in Legal information settings. Clicking that option opens module licenses page, which displays every module by name, filtered to exclude modules without license files. Clicking a module in the list opens HTMLViewer. Created ModuleLicensesProvider, a new ContentProvider that serves as a redirect for the Uris sent to HTMLViewer so that they open asset files. In order to provide the redirect, the provider will write the license file to a file in Settings' cache directory when the license does not exist in the cache or is outdated. The provider then opens that cached file. Fixes: 135183006 Test: robotests Change-Id: I7d69da34780c8c4efb150d0c0411078c12bc80d8
47 lines
1.3 KiB
Java
47 lines
1.3 KiB
Java
/*
|
|
* Copyright (C) 2019 The Android Open Source 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
|
|
*/
|
|
|
|
package com.android.settings.deviceinfo.legal;
|
|
|
|
import android.app.settings.SettingsEnums;
|
|
|
|
import com.android.settings.R;
|
|
import com.android.settings.dashboard.DashboardFragment;
|
|
|
|
public class ModuleLicensesDashboard extends DashboardFragment {
|
|
private static final String TAG = "ModuleLicensesDashboard";
|
|
|
|
@Override
|
|
public int getMetricsCategory() {
|
|
return SettingsEnums.MODULE_LICENSES_DASHBOARD;
|
|
}
|
|
|
|
@Override
|
|
protected String getLogTag() {
|
|
return TAG;
|
|
}
|
|
|
|
@Override
|
|
protected int getPreferenceScreenResId() {
|
|
return R.xml.module_licenses;
|
|
}
|
|
|
|
@Override
|
|
public int getHelpResource() {
|
|
return 0;
|
|
}
|
|
}
|