Fix Profiles tile, Ship Silence, Inline build-tools update patches

This commit is contained in:
Tad 2017-06-15 23:41:35 -04:00
parent 0b58f551b8
commit 61e242811c
8 changed files with 341 additions and 95 deletions

View File

@ -88,6 +88,7 @@
<!-- Misc -->
<project path="packages/apps/offline-calendar" name="SufficientlySecure/offline-calendar" remote="github" revision="master" />
<project path="packages/apps/Silence" name="SilenceIM/Silence" remote="github" revision="master" />
<!-- END OF ADDITIONAL REPOS -->

View File

@ -0,0 +1,30 @@
#Created from F-Droid's Android.mk
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := Silence
LOCAL_MODULE_TAGS := optional
LOCAL_PACKAGE_NAME := Silence
silence_root := $(LOCAL_PATH)
silence_out := $(PWD)/$(OUT_DIR)/target/common/obj/APPS/$(LOCAL_MODULE)_intermediates
silence_build := $(silence_root)/build
silence_apk := build/outputs/apk/Silence-release-unsigned.apk
$(silence_root)/$(silence_apk):
rm -Rf $(silence_build)
mkdir -p $(silence_out)
ln -sf $(silence_out) $(silence_build)
cd $(silence_root) && git submodule update --recursive --init
cd $(silence_root) && gradle assembleRelease
LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true
#LOCAL_OVERRIDES_PACKAGES := Messaging
LOCAL_SRC_FILES := $(silence_apk)
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)

View File

@ -0,0 +1,253 @@
From a42004f47da3d2f8128f77b7170bf84dd86d7e19 Mon Sep 17 00:00:00 2001
From: Gabriele M <moto.falcon.git@gmail.com>
Date: Mon, 27 Mar 2017 17:23:04 +0200
Subject: [PATCH] CustomTiles: Add system profiles tile
This tile opens a dialog to change the current profile. If system
profiles are disabled, they'll be enabled as soon as a profile is
selected. Disabling system profiles from the tile is not possible.
Change-Id: I38b28be8fcf1eb7998d7d18df204802ea66554f6
---
AndroidManifest.xml | 11 ++
res/drawable/ic_profiles.xml | 28 +++++
res/values/strings.xml | 4 +
src/org/lineageos/customtiles/MainActivity.java | 1 +
src/org/lineageos/customtiles/ProfileTile.java | 139 ++++++++++++++++++++++++
5 files changed, 183 insertions(+)
create mode 100644 res/drawable/ic_profiles.xml
create mode 100644 src/org/lineageos/customtiles/ProfileTile.java
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 6bef3c7..09f2de9 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -129,6 +129,17 @@
</intent-filter>
</service>
+ <!-- Profiles -->
+ <service
+ android:name=".ProfileTile"
+ android:icon="@drawable/ic_profiles"
+ android:label="@string/system_profile_label"
+ android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
+ <intent-filter>
+ <action android:name="android.service.quicksettings.action.QS_TILE" />
+ </intent-filter>
+ </service>
+
<!-- WakeLock Service -->
<service
android:name=".WakelockService"
diff --git a/res/drawable/ic_profiles.xml b/res/drawable/ic_profiles.xml
new file mode 100644
index 0000000..79f7725
--- /dev/null
+++ b/res/drawable/ic_profiles.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="?android:attr/colorAccent"
+ android:pathData="M19,5v14H5V5H19
+M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3L19,3z
+M17,8 c0-0.6-0.4-1-1-1c-0.6,0-1,0.4-1,1s0.4,1,1,1C16.6,9,17,8.6,17,8z
+M13,8c0-0.6-0.4-1-1-1c-0.6,0-1,0.4-1,1s0.4,1,1,1 C12.6,9,13,8.6,13,8z
+M9,8c0-0.6-0.4-1-1-1S7,7.4,7,8s0.4,1,1,1S9,8.6,9,8z
+M17,13h-6v-2H9v2H7v2h2v2h2v-2h6V13z" />
+</vector>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 60cb829..e0dd75e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -24,8 +24,12 @@
<string name="sync_label">Sync</string>
<string name="volume_panel_label">Volume panel</string>
<string name="usb_tether_label">USB tethering</string>
+ <string name="system_profile_label">System Profile</string>
<!-- Caffeine -->
<string name="caffeine_label">Caffeine</string>
+ <string name="dialog_system_profile_title">Select profile</string>
+ <string name="dialog_system_profile_message">No system profile found</string>
+
</resources>
diff --git a/src/org/lineageos/customtiles/MainActivity.java b/src/org/lineageos/customtiles/MainActivity.java
index 95d3015..4f9f3ba 100644
--- a/src/org/lineageos/customtiles/MainActivity.java
+++ b/src/org/lineageos/customtiles/MainActivity.java
@@ -33,6 +33,7 @@ public class MainActivity extends Activity {
put(".SyncTile", new Intent(Settings.ACTION_SYNC_SETTINGS));
put(".UsbTetherTile", new Intent(Settings.ACTION_WIRELESS_SETTINGS));
put(".VolumePanelTile", new Intent(Settings.ACTION_SOUND_SETTINGS));
+ put(".ProfileTile", new Intent("org.cyanogenmod.cmparts.PROFILES_SETTINGS"));
}};
@Override
diff --git a/src/org/lineageos/customtiles/ProfileTile.java b/src/org/lineageos/customtiles/ProfileTile.java
new file mode 100644
index 0000000..ed3caab
--- /dev/null
+++ b/src/org/lineageos/customtiles/ProfileTile.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (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.
+ */
+
+package org.lineageos.customtiles;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.service.quicksettings.Tile;
+import android.service.quicksettings.TileService;
+
+import java.util.UUID;
+
+import cyanogenmod.app.Profile;
+import cyanogenmod.app.ProfileManager;
+import cyanogenmod.providers.CMSettings;
+
+public class ProfileTile extends TileService {
+
+ private ProfileManager mProfileManager;
+
+ private Profile mCurrentProfile;
+
+ private BroadcastReceiver mReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ refresh();
+ }
+ };
+
+ @Override
+ public void onStartListening() {
+ super.onStartListening();
+
+ mProfileManager = ProfileManager.getInstance(getBaseContext());
+
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(ProfileManager.INTENT_ACTION_PROFILE_SELECTED);
+ filter.addAction(ProfileManager.INTENT_ACTION_PROFILE_UPDATED);
+ filter.addAction(ProfileManager.PROFILES_STATE_CHANGED_ACTION);
+ registerReceiver(mReceiver, filter);
+
+ refresh();
+ }
+
+ @Override
+ public void onStopListening() {
+ unregisterReceiver(mReceiver);
+ super.onStopListening();
+ }
+
+ private Dialog selectProfileDialog() {
+
+ Profile[] profilesList = mProfileManager.getProfiles();
+ if (profilesList.length == 0) {
+ return new AlertDialog.Builder(getBaseContext())
+ .setTitle(R.string.dialog_system_profile_title)
+ .setMessage(R.string.dialog_system_profile_message)
+ .setPositiveButton(android.R.string.ok, null)
+ .create();
+ }
+
+ final CharSequence[] profileLabels = new CharSequence[profilesList.length];
+ final UUID[] profileUuids = new UUID[profilesList.length];
+ int selectedProfile = -1;
+ for (int i = 0; i < profilesList.length; i++) {
+ UUID profileUuuid = profilesList[i].getUuid();
+ profileLabels[i] = profilesList[i].getName();
+ profileUuids[i] = profileUuuid;
+ if (mCurrentProfile != null && mCurrentProfile.getUuid().equals(profileUuuid)) {
+ selectedProfile = i;
+ }
+ }
+
+ return new AlertDialog.Builder(getBaseContext())
+ .setTitle(R.string.dialog_system_profile_title)
+ .setSingleChoiceItems(profileLabels, selectedProfile,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialogInterface, int index) {
+ if (!mProfileManager.isProfilesEnabled()) {
+ enableProfiles();
+ }
+ mProfileManager.setActiveProfile(profileUuids[index]);
+ dialogInterface.dismiss();
+ }
+ })
+ .setNegativeButton(android.R.string.cancel, null)
+ .setCancelable(true)
+ .create();
+ }
+
+ @Override
+ public void onClick() {
+ super.onClick();
+
+ unlockAndRun(new Runnable() {
+ @Override
+ public void run() {
+ showDialog(selectProfileDialog());
+ }
+ });
+ }
+
+ private void refresh() {
+ if (mProfileManager.isProfilesEnabled()) {
+ mCurrentProfile = mProfileManager.getActiveProfile();
+ getQsTile().setState(Tile.STATE_ACTIVE);
+ getQsTile().setLabel(mCurrentProfile.getName());
+ } else {
+ mCurrentProfile = null;
+ getQsTile().setState(Tile.STATE_INACTIVE);
+ getQsTile().setLabel(getString(R.string.system_profile_label));
+ }
+ getQsTile().updateTile();
+ }
+
+ private void enableProfiles() {
+ CMSettings.System.putInt(getContentResolver(),
+ CMSettings.System.SYSTEM_PROFILES_ENABLED, 1);
+ }
+}
--
2.13.1

View File

@ -1,48 +0,0 @@
From fbc5ea49609b7719a9399541d6a9525910478961 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Sun, 18 Dec 2016 16:54:51 -0500
Subject: [PATCH] Build fixes
Change-Id: I5ae430d0af5b1a111079f92f6d7e001597152008
---
Android.mk | 4 ++--
build.gradle | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Android.mk b/Android.mk
index 2102bd1..9cc8e60 100644
--- a/Android.mk
+++ b/Android.mk
@@ -21,14 +21,14 @@ LOCAL_PACKAGE_NAME := FakeStore
fakestore_root := $(LOCAL_PATH)
fakestore_dir := fake-store
-fakestore_out := $(OUT_DIR)/target/common/obj/APPS/$(LOCAL_MODULE)_intermediates
+fakestore_out := $(PWD)/$(OUT_DIR)/target/common/obj/APPS/$(LOCAL_MODULE)_intermediates
fakestore_build := $(fakestore_root)/$(fakestore_dir)/build
fakestore_apk := build/outputs/apk/fake-store-release-unsigned.apk
$(fakestore_root)/$(fakestore_dir)/$(fakestore_apk):
rm -Rf $(fakestore_build)
mkdir -p $(fakestore_out)
- ln -s $(fakestore_out) $(fakestore_build)
+ ln -sf $(fakestore_out) $(fakestore_build)
echo "sdk.dir=$(ANDROID_HOME)" > $(fakestore_root)/local.properties
cd $(fakestore_root) && git submodule update --recursive --init
cd $(fakestore_root)/$(fakestore_dir) && JAVA_TOOL_OPTIONS="$(JAVA_TOOL_OPTIONS) -Dfile.encoding=UTF8" ../gradlew assembleRelease
diff --git a/build.gradle b/build.gradle
index 3ec4bfc..8a7d2e2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -26,7 +26,7 @@ buildscript {
allprojects {
apply plugin: 'idea'
- ext.androidBuildVersionTools = "24.0.3"
+ ext.androidBuildVersionTools = "25.0.1"
ext.isReleaseVersion = false
}
--
2.9.3

View File

@ -1,42 +0,0 @@
From 5178642bc1092a259d1dd366859083ebe740bb6e Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Sun, 29 Jan 2017 12:50:51 -0500
Subject: [PATCH] Build fixes
Change-Id: I5843e1df6191d76641893b452eb5e6e0b4334418
---
Android.mk | 2 +-
build.gradle | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Android.mk b/Android.mk
index 1da0fbb..74fff61 100644
--- a/Android.mk
+++ b/Android.mk
@@ -7,7 +7,7 @@ LOCAL_MODULE_TAGS := optional
LOCAL_PACKAGE_NAME := IchnaeaNlpBackend
ichnaea_root := $(LOCAL_PATH)
-ichnaea_out := $(OUT_DIR)/target/common/obj/APPS/$(LOCAL_MODULE)_intermediates
+ichnaea_out := $(PWD)/$(OUT_DIR)/target/common/obj/APPS/$(LOCAL_MODULE)_intermediates
ichnaea_build := $(ichnaea_root)/build
ichnaea_apk := build/outputs/apk/IchnaeaNlpBackend-release-unsigned.apk
diff --git a/build.gradle b/build.gradle
index abfde7c..f80763c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -58,8 +58,8 @@ dependencies {
}
android {
- compileSdkVersion 23
- buildToolsVersion "23.0.2"
+ compileSdkVersion 24
+ buildToolsVersion "25.0.1"
defaultConfig {
versionName getMyVersionName()
--
2.9.3

View File

@ -10,3 +10,11 @@ PRODUCT_PACKAGES += \
PRODUCT_PACKAGES += \
F-Droid \
FDroidPrivilegedExtension
# Offline Calendar
#PRODUCT_PACKAGES += \
# OfflineCalendar
# Slience
PRODUCT_PACKAGES += \
Silence

View File

@ -0,0 +1,29 @@
#Created from F-Droid's Android.mk
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := OfflineCalendar
LOCAL_MODULE_TAGS := optional
LOCAL_PACKAGE_NAME := OfflineCalendar
offlinecalendar_root := $(LOCAL_PATH)
offlinecalendar_dir := Offline-Calendar
offlinecalendar_out := $(PWD)/$(OUT_DIR)/target/common/obj/APPS/$(LOCAL_MODULE)_intermediates
offlinecalendar_build := $(offlinecalendar_root)/$(offlinecalendar_dir)/build
offlinecalendar_apk := build/outputs/apk/$(offlinecalendar_dir)-release-unsigned.apk
$(offlinecalendar_root)/$(offlinecalendar_dir)/$(offlinecalendar_apk):
rm -Rf $(offlinecalendar_build)
mkdir -p $(offlinecalendar_out)
ln -sf $(offlinecalendar_out) $(offlinecalendar_build)
cd $(offlinecalendar_root)/$(offlinecalendar_dir) && gradle assembleRelease
LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true
LOCAL_SRC_FILES := $(offlinecalendar_dir)/$(offlinecalendar_apk)
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)

View File

@ -2,7 +2,7 @@
#Copyright (c) 2015-2017 Spot Communications, Inc.
#Delete Everything
#repo forall -c 'git add -A && git reset --hard' && rm -rf packages/apps/F-Droid packages/apps/GmsCore out
#repo forall -c 'git add -A && git reset --hard' && rm -rf packages/apps/F-Droid packages/apps/GmsCore packages/apps/Silence out
#Prepare a build
#repo sync -j20 --force-sync && sh ../../Scripts/LAOS-14.1_Patches.sh && source ../../Scripts/Generic_Deblob.sh && source build/envsetup.sh && export ANDROID_HOME="/home/$USER/Android/Sdk" && export ANDROID_JACK_VM_ARGS="-Xmx6144m -Xms512m -Dfile.encoding=UTF-8 -XX:+TieredCompilation" && export JACK_SERVER_VM_ARGUMENTS="${ANDROID_JACK_VM_ARGS}" && GRADLE_OPTS=-Xmx2048m && export KBUILD_BUILD_USER=emy && export KBUILD_BUILD_HOST=dosbm
@ -91,7 +91,7 @@ enter "packages/apps/CMUpdater"
patch -p1 < $patches"android_packages_apps_CMUpdater/0001-Server.patch" #Switch to our server
enter "packages/apps/CustomTiles"
git fetch https://review.lineageos.org/LineageOS/android_packages_apps_CustomTiles refs/changes/69/167069/1 && git cherry-pick FETCH_HEAD #System profiles tile
patch -p1 < $patches"android_packages_apps_CustomTiles/0001-Profiles.patch" #System profiles tile
enter "packages/apps/Dialer"
sed -i 's/FLP_DEFAULT = FLP_GOOGLE;/FLP_DEFAULT = FLP_OPENSTREETMAP;/' src/com/android/dialer/lookup/LookupSettings.java; #Change default FLP to OpenStreetMap
@ -100,7 +100,9 @@ sed -i 's/CMSettings.System.ENABLE_PEOPLE_LOOKUP, 1)/CMSettings.System.ENABLE_PE
#sed -i 's/CMSettings.System.ENABLE_REVERSE_LOOKUP, 1)/CMSettings.System.ENABLE_REVERSE_LOOKUP, 0)/' src/com/android/dialer/lookup/LookupSettings.java; #Disable RLP by default
enter "packages/apps/FakeStore"
patch -p1 < $patches"android_packages_apps_FakeStore/0001-Fixes.patch" #Update output paths and build tools
sed -i 's|$(OUT_DIR)/target/|$(PWD)/$(OUT_DIR)/target/|' Android.mk;
sed -i 's/ln -s /ln -sf /' Android.mk;
sed -i 's/ext.androidBuildVersionTools = "24.0.3"/ext.androidBuildVersionTools = "25.0.3"/' build.gradle;
enter "packages/apps/FDroid"
patch -p1 < $patches"android_packages_apps_FDroid/0001.patch" #Enable privigled module
@ -111,18 +113,31 @@ patch -p1 < $patches"android_packages_apps_FDroidPrivilegedExtension/0002-Releas
#release-keys: CB:1E:E2:EC:40:D0:5E:D6:78:F4:2A:E7:01:CD:FA:29:EE:A7:9D:0E:6D:63:32:76:DE:23:0B:F3:49:40:67:C3
#test-keys: C8:A2:E9:BC:CF:59:7C:2F:B6:DC:66:BE:E2:93:FC:13:F2:FC:47:EC:77:BC:6B:2B:0D:52:C1:1F:51:19:2A:B8
enter "packages/apps/GsfProxy"
sed -i 's/ext.androidBuildVersionTools = "24.0.3"/ext.androidBuildVersionTools = "25.0.3"/' build.gradle;
enter "packages/apps/IchnaeaNlpBackend"
patch -p1 < $patches"android_packages_apps_IchnaeaNlpBackend/0001-Fixes.patch" #Update output paths and build tools
sed -i 's|$(OUT_DIR)/target/|$(PWD)/$(OUT_DIR)/target/|' Android.mk;
sed -i 's/compileSdkVersion 23/compileSdkVersion 25/' build.gradle;
sed -i 's/buildToolsVersion "23.0.2"/buildToolsVersion "25.0.3"/' build.gradle;
enter "packages/apps/Nfc"
sed -i 's/static final boolean NFC_ON_DEFAULT = true;/static final boolean NFC_ON_DEFAULT = false;/' src/com/android/nfc/NfcService.java; #Disable NFC by default
sed -i 's/static final boolean NDEF_PUSH_ON_DEFAULT = true;/static final boolean NDEF_PUSH_ON_DEFAULT = false;/' src/com/android/nfc/NfcService.java; #Disable NDEF Push by default
enter "packages/apps/offline-calendar"
cp $patches"offline-calendar/Android.mk" Android.mk #Add a build file
sed -i 's/compileSdkVersion 23/compileSdkVersion 25/' Offline-Calendar/build.gradle;
sed -i 's/buildToolsVersion "23.0.3"/buildToolsVersion "25.0.3"/' Offline-Calendar/build.gradle;
enter "packages/apps/Settings"
sed -i 's/Settings.Secure.WEB_ACTION_ENABLED, 1/Settings.Secure.WEB_ACTION_ENABLED, 0/' src/com/android/settings/applications/ManageDomainUrls.java; #Disable "Instant Apps"
sed -i 's/private int mPasswordMaxLength = 16;/private int mPasswordMaxLength = 48;/' src/com/android/settings/ChooseLockPassword.java; #Increase max password length
sed -i 's/GSETTINGS_PROVIDER = "com.google.settings";/GSETTINGS_PROVIDER = "com.google.oQuae4av";/' src/com/android/settings/PrivacySettings.java; #MicroG doesn't support Backup, hide the options
enter "packages/apps/Silence"
cp $patches"Silence/Android.mk" Android.mk #Add a build file
enter "packages/inputmethods/LatinIME"
patch -p1 < $patches"android_packages_inputmethods_LatinIME/0001-Voice.patch" #Remove voice input key
@ -163,7 +178,7 @@ disableDexPreOpt #bootloops
patch -p1 < $patches"android_device_lge_mako/0001-Enable_LTE.patch" #Enable LTE support (Requires LTE hybrid modem to be flashed)
#enter "kernel/lge/mako"
#patch -p1 < $patches"android_kernel_lge_mako/0001-OverUnderClock.patch" #384Mhz -> 81Mhz, 1.51Ghz -> 1.94Ghz =+1.72Ghz #XXX: Causes *excessively* long boot times
#patch -p1 < $patches"android_kernel_lge_mako/0001-OverUnderClock.patch" #384Mhz -> 81Mhz, 1.51Ghz -> 1.94Ghz =+1.72Ghz XXX: Causes *excessively* long boot times
enter "kernel/lge/hammerhead"
patch -p1 < $patches"android_kernel_lge_hammerhead/0001-OverUnderClock.patch" #2.26Ghz -> 2.95Ghz =+2.76Ghz