Merge remote-tracking branch 'lineageos/cm-13.0' into replicant-6.0
This commit is contained in:
commit
73652644f2
|
@ -60,7 +60,7 @@ public class PerformanceManagerService extends CMSystemService {
|
|||
// keep in sync with hardware/libhardware/include/hardware/power.h
|
||||
private final int POWER_HINT_CPU_BOOST = 0x00000010;
|
||||
private final int POWER_HINT_LAUNCH_BOOST = 0x00000011;
|
||||
private final int POWER_HINT_SET_PROFILE = 0x00000030;
|
||||
private final int POWER_HINT_SET_PROFILE = 0x00000012;
|
||||
|
||||
private final int POWER_FEATURE_SUPPORTED_PROFILES = 0x00001000;
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
<string name="live_display_auto">Automático</string>
|
||||
<string name="live_display_auto_summary">Ajustar automáticamente la temperatura del color de pantalla con el amanecer y el anochecer</string>
|
||||
<string name="live_display_off">Desactivado</string>
|
||||
<string name="live_display_off_summary">Deshabilitar todos los ajustes</string>
|
||||
<string name="live_display_off_summary">Desactivar todos los ajustes</string>
|
||||
<string name="live_display_day">Día</string>
|
||||
<string name="live_display_day_summary">Utilizar solo los ajustes de día</string>
|
||||
<string name="live_display_night">Noche</string>
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- Label for the LineageOS system components when they are shown to the user. -->
|
||||
<string name="cyanogenmod_system_label">LineageOS sustav</string>
|
||||
<string name="permlab_publishCustomTile">stvorite prilagođenu pločicu u brzim postavkama</string>
|
||||
<string name="permdesc_publishCustomTile">Omogućuje aplikaciji da objavi brzo postavljanje pločica.</string>
|
||||
<string name="permlab_modifyNetworkSettings">promijenite postavke mrežnog sustava</string>
|
||||
<string name="permdesc_modifyNetworkSettings">Dopušta aplikaciji promijeniti postavke za zrakoplovni način i mobilne podatke.</string>
|
||||
<string name="permlab_publishCustomTile">stvori prilagođenu pločicu u brzim postavkama</string>
|
||||
<string name="permdesc_publishCustomTile">Dopušta aplikaciji da stvori pločicu u brzim postavkama.</string>
|
||||
<string name="permlab_modifyNetworkSettings">promijeni sistemske postavke mreže</string>
|
||||
<string name="permdesc_modifyNetworkSettings">Dopušta aplikaciji mijenjanje postavki za zrakoplovni način i mobilne podatke.</string>
|
||||
<string name="permlab_modifySoundSettings">promijeni postavke zvukova sustava</string>
|
||||
<string name="permdesc_modifySoundSettings">Dopušta aplikaciji promijeniti postavke za mod prekidanja zvuka.</string>
|
||||
<string name="permlab_bindCustomTileListenerService">vezuje za zadanu pločicu usluga nadgledanja</string>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- Label for the LineageOS system components when they are shown to the user. -->
|
||||
<string name="cyanogenmod_system_label">LineageOSシステム</string>
|
||||
<string name="cyanogenmod_system_label">LineageOS システム</string>
|
||||
<string name="permlab_publishCustomTile">クイック設定パネルでのカスタムタイルの作成</string>
|
||||
<string name="permdesc_publishCustomTile">クイック設定タイルの作成をアプリに許可します</string>
|
||||
<string name="permlab_modifyNetworkSettings">システムのネットワークの設定の変更</string>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- Label for the LineageOS system components when they are shown to the user. -->
|
||||
<string name="cyanogenmod_system_label">LineageOS Systeem</string>
|
||||
<string name="cyanogenmod_system_label">LineageOS-systeem</string>
|
||||
<string name="permlab_publishCustomTile">een aangepaste tegel aanmaken in het snelle instellingenpaneel</string>
|
||||
<string name="permdesc_publishCustomTile">Hiermee kan een app een tegel toevoegen aan Snelle instellingen.</string>
|
||||
<string name="permlab_modifyNetworkSettings">systeemnetwerkinstellingen wijzigen</string>
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--Generated by crowdin.com-->
|
||||
<!--
|
||||
Copyright (C) 2015 The CyanogenMod Project
|
||||
(C) 2017 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">
|
||||
<!-- Label for the LineageOS system components when they are shown to the user. -->
|
||||
<!-- Labels for the READ_MSIM_PHONE_STATE permission. -->
|
||||
<!-- Labels for the MODIFY_MSIM_PHONE_STATE permission. -->
|
||||
<!-- Labels for the MODIFY_PROFILES permission. -->
|
||||
<!-- Labels for the HARDWARE_ABSTRACTION_ACCESS permission. -->
|
||||
<!-- Labels for the WRITE_ALARMS permission. -->
|
||||
<!-- Labels for the MANAGE_ALARMS permission. -->
|
||||
<!-- Labels for the READ_ALARMS permission. -->
|
||||
<!-- Labels for the WRITE_SETTINGS permission -->
|
||||
<!-- Labels for the WRITE_SECURE_SETTINGS permission -->
|
||||
<!-- Labels for the MANAGE_PERSISTENT_STORAGE permission. -->
|
||||
<!-- Labels for the ACCESS_APP_SUGGESTIONS permission -->
|
||||
<!-- Label to show for a service that is running because it is observing the user's custom tiles. -->
|
||||
<!-- Labels for the PROTECTED_APP permission. -->
|
||||
<!-- Profiles -->
|
||||
<!-- Names of default profiles. -->
|
||||
<!-- Names of application groups. -->
|
||||
<!-- Name of wildcard profile. -->
|
||||
<!-- Performance profiles -->
|
||||
<!-- LiveDisplay strings -->
|
||||
<!-- Third party keyguard permission label -->
|
||||
<!-- Third party keyguard permission description -->
|
||||
<!-- Device specific settings -->
|
||||
<!-- Touchscreen gestures -->
|
||||
<!-- Touchscreen gesture haptic feedback -->
|
||||
<!-- Theme installation error notification -->
|
||||
<!-- Theme reset notification -->
|
||||
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<!-- Performance manager permission title -->
|
||||
<!-- Performance manager permission description -->
|
||||
<!-- Access live lock screen manager service permission label -->
|
||||
<!-- Access live lock screen manager service permission description -->
|
||||
<!-- Privileged access live lock screen manager service permission label -->
|
||||
<!-- Privileged access live lock screen manager service permission description -->
|
||||
<!-- Live lock screen manager service provider permission label -->
|
||||
<!-- Live lock screen manager service provider permission description -->
|
||||
<!-- Weather Service strings -->
|
||||
<!-- DataUsageProvider write permission title -->
|
||||
<!-- DataUsageProvider write permission description -->
|
||||
<!-- DataUsageProvider read permission title -->
|
||||
<!-- DataUsageProvider read permission description -->
|
||||
<!-- LiveDisplay manager permission -->
|
||||
<!-- CMAudioService - observe session changes permission -->
|
||||
<!-- CMAudioService - observe session changes permission -->
|
||||
<!-- QuickSettings: Themes tile -->
|
||||
<!-- Custom booot dexopt -->
|
||||
</resources>
|
|
@ -22,7 +22,9 @@
|
|||
<string name="permlab_publishCustomTile">Створити власну плитку для панелі швидких налаштувань</string>
|
||||
<string name="permdesc_publishCustomTile">Дозволяє додатку створити плитку швидких налаштувань.</string>
|
||||
<string name="permlab_modifyNetworkSettings">змінювати налаштування мережі системи</string>
|
||||
<string name="permdesc_modifyNetworkSettings">Дозволяє додатку вносити зміни в \"Режимі польоту\" і в налаштуваннях мобільної передачі даних.</string>
|
||||
<string name="permlab_modifySoundSettings">змінювати звукові налаштування системи</string>
|
||||
<string name="permdesc_modifySoundSettings">Дозволяє додатку вносити зміни налаштувань звуку в режимі сповіщень.</string>
|
||||
<string name="permlab_bindCustomTileListenerService">прив’язати до власної служби</string>
|
||||
<string name="permdesc_bindCustomTileListenerService">Дозволяє власникові прив\'язувати плитки до інтерфесу високого рівня служб.</string>
|
||||
<!-- Labels for the READ_MSIM_PHONE_STATE permission. -->
|
||||
|
@ -33,6 +35,7 @@
|
|||
<string name="permdesc_modifyMSPhoneState">Дозволяє програмі змінювати стан телефону і з’єднання даних з підтримкою до декількох SIM.</string>
|
||||
<!-- Labels for the MODIFY_PROFILES permission. -->
|
||||
<string name="permlab_modifyProfiles">зміна системних профілів</string>
|
||||
<string name="permdesc_modifyProfiles">Дозволяє додатку змінювати системні профілі.</string>
|
||||
<!-- Labels for the HARDWARE_ABSTRACTION_ACCESS permission. -->
|
||||
<string name="permlab_useHardwareFramework">Взаємодія із обладнанням</string>
|
||||
<string name="permdesc_useHardwareFramework">Додаток зможе отримувати доступ до підсистеми апаратних абстракцій CyanogenMod.</string>
|
||||
|
@ -52,6 +55,8 @@
|
|||
<string name="permlab_writeSecureSettings">змінювати налаштування безпеки</string>
|
||||
<string name="permdesc_writeSecureSettings">Дозволяє додатку змінювати системні налаштування безпеки. Непотрібно звичайним додаткам.</string>
|
||||
<!-- Labels for the MANAGE_PERSISTENT_STORAGE permission. -->
|
||||
<string name="permlab_managePersistentStorage">керування постійною пам\'яттю даних</string>
|
||||
<string name="permdesc_managePersistentStorage">Дозволяє додатку зчитувати і записувати властивості, які можуть зберігатися навіть після відновлення заводських налаштувань.</string>
|
||||
<!-- Labels for the ACCESS_APP_SUGGESTIONS permission -->
|
||||
<string name="permlab_accessAppSuggestions">Доступ до рекомендованих додатків</string>
|
||||
<string name="permdesc_accessAppSuggestions">Додаток зможе отримувати доступ до списку рекомендованих додатків.</string>
|
||||
|
@ -94,6 +99,16 @@
|
|||
<string name="live_display_outdoor">Надворі (яскраве сонце)</string>
|
||||
<string name="live_display_outdoor_summary">Використовувати параметри для яскравого освітлення надворі</string>
|
||||
<string name="live_display_hint">LiveDisplay допоможе зменшити навантаження на зір та покращить Ваш сон. Натисніть тут, щоб спробувати його!</string>
|
||||
<string name="accessibility_quick_settings_live_display_off">LiveDisplay вимкнений.</string>
|
||||
<string name="accessibility_quick_settings_live_display_auto">LiveDisplay: автоматичний режим.</string>
|
||||
<string name="accessibility_quick_settings_live_display_day">LiveDisplay: денний режим.</string>
|
||||
<string name="accessibility_quick_settings_live_display_night">LiveDisplay: нічний режим.</string>
|
||||
<string name="accessibility_quick_settings_live_display_outdoor">LiveDisplay: режим на вулиці.</string>
|
||||
<string name="accessibility_quick_settings_live_display_changed_off">LiveDisplay вимкнено.</string>
|
||||
<string name="accessibility_quick_settings_live_display_changed_auto">LiveDisplay змінено до автоматичного режиму.</string>
|
||||
<string name="accessibility_quick_settings_live_display_changed_day">LiveDisplay змінено до денного режиму.</string>
|
||||
<string name="accessibility_quick_settings_live_display_changed_night">LiveDisplay змінено до нічного режиму.</string>
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay змінено до режиму на вулиці.</string>
|
||||
<!-- Third party keyguard permission label -->
|
||||
<string name="permlab_thirdPartyKeyguard">Нетиповий екран блокування</string>
|
||||
<!-- Third party keyguard permission description -->
|
||||
|
@ -107,29 +122,75 @@
|
|||
<string name="touchscreen_gesture_haptic_feedback">Вібро-відгук</string>
|
||||
<string name="touchscreen_gesture_haptic_feedback_summary">Вібрувати, коли виявлено жест</string>
|
||||
<!-- Theme installation error notification -->
|
||||
<string name="theme_install_error_title">Не вдалося встановити тему</string>
|
||||
<string name="theme_install_error_message"><xliff:g id="theme">%1$s </xliff:g> не вдалося встановити</string>
|
||||
<!-- Theme reset notification -->
|
||||
<string name="theme_reset_notification_title">Скинути тему</string>
|
||||
<string name="theme_reset_notification_message">Через збої в роботі додатків встановлено системну тему.</string>
|
||||
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<string name="permlab_accessThemeService">доступ до служби тем</string>
|
||||
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<string name="permdesc_accessThemeService">Дозволяє додатку отримувати доступ до служби тем. Цей дозвіл не використовується звичайними додатками.</string>
|
||||
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<string name="permlab_readThemes">читати дані вашої теми</string>
|
||||
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<string name="permdesc_readThemesDesc">Дозволяє додатку читати дані про теми і
|
||||
виявляти, яку тему зараз застосовано.</string>
|
||||
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<string name="permlab_writeThemes">змінювати теми</string>
|
||||
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<string name="permdesc_writeThemesDesc">Дозволяє додатку встановлювати нові теми і змінювати поточну.</string>
|
||||
<!-- Performance manager permission title -->
|
||||
<string name="permlab_perfAccess">доступ до менеджера продуктивності</string>
|
||||
<!-- Performance manager permission description -->
|
||||
<string name="permdesc_perfAccessDesc">Дозволяє додатку отримувати доступ до менеджера продуктивності. Цей дозвіл не потрібний звичайним додаткам.</string>
|
||||
<!-- Access live lock screen manager service permission label -->
|
||||
<string name="permlab_accessLiveLockScreenService">доступ до сервісу живого екрану блокування</string>
|
||||
<!-- Access live lock screen manager service permission description -->
|
||||
<string name="permdesc_accessLiveLockScreenService">Надає додатку доступ до сервісу керування живим екраном блокування.</string>
|
||||
<!-- Privileged access live lock screen manager service permission label -->
|
||||
<string name="permlab_accessLiveLockScreenServicePrivate">доступ до сервісу живого екрану блокування</string>
|
||||
<!-- Privileged access live lock screen manager service permission description -->
|
||||
<string name="permdesc_accessLiveLockScreenServicePrivate">Надає системним додаткам доступ до сервісу керування живим екраном блокування.</string>
|
||||
<!-- Live lock screen manager service provider permission label -->
|
||||
<string name="permlab_accessLiveLockScreenServiceProvider">доступ до сервісу живого екрану блокування</string>
|
||||
<!-- Live lock screen manager service provider permission description -->
|
||||
<string name="permdesc_accessLiveLockScreenServiceProvider">Дозволяє додатку доступ до сервісу живого екрану блокування.</string>
|
||||
<!-- Weather Service strings -->
|
||||
<string name="permlab_weather_read">читати погоду</string>
|
||||
<string name="permdesc_weather_read">Дозволити додатку читати дані від провайдера погоди.</string>
|
||||
<string name="permlab_weather_write">оновлення провайдера погоди</string>
|
||||
<string name="permdesc_weather_write">Дозволяє додатку оновлювати дані провайдера погоди.</string>
|
||||
<string name="permlab_weather_bind">прив\'язати як провайдера погоди</string>
|
||||
<string name="permdesc_weather_bind">Дозволяє додатку бути службою провайдера погоди.</string>
|
||||
<string name="permlab_weather_access_mgr">доступ до служби погоди</string>
|
||||
<string name="permdesc_weather_access_mgr">Дозволити додатку доступ до служби погоди в системі. Це ніколи не потрібно для звичайних додатків.</string>
|
||||
<!-- DataUsageProvider write permission title -->
|
||||
<string name="permlab_dataUsageWrite">змінювати дані використання бази даних</string>
|
||||
<!-- DataUsageProvider write permission description -->
|
||||
<string name="permdesc_dataUsageWrite">Дозволяє додатку оновлювати вміст БД використання даних.</string>
|
||||
<!-- DataUsageProvider read permission title -->
|
||||
<string name="permlab_dataUsageRead">читати дані використання бази даних</string>
|
||||
<!-- DataUsageProvider read permission description -->
|
||||
<string name="permdesc_dataUsageRead">Дозволяє додатку читати вміст БД використання даних.</string>
|
||||
<!-- LiveDisplay manager permission -->
|
||||
<string name="permlab_manageLiveDisplay">керування налаштуваннями LiveDisplay</string>
|
||||
<string name="permdesc_manageLiveDisplay">Дозволяє додатку керувати розширеними налаштуваннями дисплея.</string>
|
||||
<!-- CMAudioService - observe session changes permission -->
|
||||
<string name="permlab_observe_audio_sessions">спостерігати за змінами аудіо сесії</string>
|
||||
<string name="permdesc_observe_audio_sessions">Дозволяє додатку переглядати аудіопотоки, які створюються або знищуються.</string>
|
||||
<!-- CMAudioService - observe session changes permission -->
|
||||
<string name="permlab_manage_audio_sessions">керувати змінами аудіо сесії</string>
|
||||
<string name="permdesc_manage_audio_sessions">Дозволяє додатку змінювати параметри аудіопотоків.</string>
|
||||
<!-- QuickSettings: Themes tile -->
|
||||
<string name="qs_themes_label">Теми</string>
|
||||
<string name="qs_themes_content_description">Налаштувати вашу тему</string>
|
||||
<!-- Custom booot dexopt -->
|
||||
<string name="android_upgrading_starting_apps">Запуск додатків\u2026</string>
|
||||
<string name="android_upgrading_fstrim">Оптимізація пам\'яті\u2026</string>
|
||||
<string name="android_upgrading_complete">Підготовка до запуску\u2026</string>
|
||||
<string name="android_upgrading_complete_details">Оптимізацію завершено.</string>
|
||||
<string name="android_preparing_apk">Підготовка %1$s\u2026</string>
|
||||
<string name="android_preparing_apk_obscured">Підготовка додатків\u2026</string>
|
||||
<string name="android_upgrading_apk">%1$d з %2$d додатків</string>
|
||||
</resources>
|
||||
|
|
|
@ -179,8 +179,17 @@
|
|||
<string name="permlab_observe_audio_sessions">quan sát các thay đổi về phiên âm thanh</string>
|
||||
<string name="permdesc_observe_audio_sessions">Cho phép ứng dụng quan sát dòng âm thanh được tạo và bị hủy.</string>
|
||||
<!-- CMAudioService - observe session changes permission -->
|
||||
<string name="permlab_manage_audio_sessions">quản lý thay đổi âm thanh phiên</string>
|
||||
<string name="permdesc_manage_audio_sessions">Cho phép một ứng dụng gửi thông tin các cập nhật stream âm thanh.</string>
|
||||
<!-- QuickSettings: Themes tile -->
|
||||
<string name="qs_themes_label">Chủ đề</string>
|
||||
<string name="qs_themes_content_description">Tùy chỉnh chủ đề của bạn</string>
|
||||
<!-- Custom booot dexopt -->
|
||||
<string name="android_upgrading_starting_apps">Đang mở ứng dụng\u2026</string>
|
||||
<string name="android_upgrading_fstrim">Tối ưu hóa bộ nhớ\u2026</string>
|
||||
<string name="android_upgrading_complete">Đang chuẩn bị bắt đầu\u2026</string>
|
||||
<string name="android_upgrading_complete_details">Tối ưu hóa hoàn tất.</string>
|
||||
<string name="android_preparing_apk">Đang chuẩn bị %1$s\u2026</string>
|
||||
<string name="android_preparing_apk_obscured">Đang chuẩn bị ứng dụng\u2026</string>
|
||||
<string name="android_upgrading_apk">%1$d trong số %2$d ứng dụng</string>
|
||||
</resources>
|
||||
|
|
|
@ -16,5 +16,5 @@
|
|||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<string name="app_name">CM設定ストレージ</string>
|
||||
<string name="app_name">LineageOS 設定ストレージ</string>
|
||||
</resources>
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--Generated by crowdin.com-->
|
||||
<!--
|
||||
Copyright (C) 2014-2015 The CyanogenMod 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></resources>
|
|
@ -126,7 +126,11 @@ import java.util.Map;
|
|||
* they may change at slightly different times.
|
||||
*
|
||||
* Test whether the setting was properly set and is not null.
|
||||
*
|
||||
* @deprecated Replaced by {@link Settings.Global#DEVICE_PROVISIONED}
|
||||
* or {@link Settings.Secure#USER_SETUP_COMPLETE}
|
||||
*/
|
||||
@Deprecated
|
||||
@SmallTest
|
||||
public void testCMProvisionedFlagFallbackSet() {
|
||||
final String newCmFlag = CMSettings.Secure.getStringForUser(
|
||||
|
|
|
@ -2829,8 +2829,11 @@ public final class CMSettings {
|
|||
* Set to 0 when we enter the CM Setup Wizard.
|
||||
* Set to 1 when we exit the CM Setup Wizard.
|
||||
*
|
||||
* @deprecated Use {@link Secure#USER_SETUP_COMPLETE} or
|
||||
* {@link Settings.Global#DEVICE_PROVISIONED} instead
|
||||
* @hide
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String CM_SETUP_WIZARD_COMPLETED = "cm_setup_wizard_completed";
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
/**
|
||||
* Copyright (C) 2016 The CyanogenMod 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 org.cyanogenmod.internal.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
public final class PackageManagerUtils {
|
||||
private static final int FLAG_SUSPENDED = 1 << 30;
|
||||
|
||||
private PackageManagerUtils() {
|
||||
// This class is not supposed to be instantiated
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a given package exists
|
||||
*
|
||||
* @param context
|
||||
* @param packageName
|
||||
* @return true if the package exists
|
||||
*/
|
||||
public static boolean isAppInstalled(final Context context, final String packageName) {
|
||||
return getApplicationInfo(context, packageName, 0) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a package with specific flags is enabled
|
||||
*
|
||||
* @param context
|
||||
* @param packageName
|
||||
* @param flags
|
||||
* @return true if the package is enabled
|
||||
*/
|
||||
public static boolean isAppEnabled(final Context context,
|
||||
final String packageName, final int flags) {
|
||||
final ApplicationInfo info = getApplicationInfo(context, packageName, flags);
|
||||
return info != null && info.enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a package is enabled
|
||||
*
|
||||
* @param context
|
||||
* @param packageName
|
||||
* @return true if the package is enabled
|
||||
*/
|
||||
public static boolean isAppEnabled(final Context context, final String packageName) {
|
||||
return isAppEnabled(context, packageName, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a package can possibly be on the SDCard
|
||||
* This is just a workaround and doesn't guarantee that the app is on SD card
|
||||
*
|
||||
* @param context
|
||||
* @param packageName
|
||||
* @return true if the package is on the SDCard
|
||||
*/
|
||||
public static boolean isAppOnSdcard(final Context context, final String packageName) {
|
||||
return isAppEnabled(context, packageName, PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a package is suspended
|
||||
*
|
||||
* @param context
|
||||
* @param packageName
|
||||
* @return true if the package is suspended
|
||||
*/
|
||||
public static boolean isAppSuspended(final Context context, final String packageName) {
|
||||
return isAppSuspended(getApplicationInfo(context, packageName, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a package is suspended
|
||||
*
|
||||
* @param info
|
||||
* @return true if the package is suspended
|
||||
*/
|
||||
public static boolean isAppSuspended(final ApplicationInfo info) {
|
||||
return info != null && (info.flags & FLAG_SUSPENDED) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ApplicationInfo of a package
|
||||
*
|
||||
* @param context
|
||||
* @param packageName
|
||||
* @param flags
|
||||
* @return null if the package cannot be found or the ApplicationInfo is null
|
||||
*/
|
||||
public static ApplicationInfo getApplicationInfo(final Context context,
|
||||
final String packageName, final int flags) {
|
||||
final PackageManager packageManager = context.getPackageManager();
|
||||
ApplicationInfo info;
|
||||
try {
|
||||
info = packageManager.getApplicationInfo(packageName, flags);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
info = null;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue