Skip to content

Commit

Permalink
base: Introduce SubstratumService
Browse files Browse the repository at this point in the history
Change-Id: I8c9f331ca7e4c68c35ea13bed587775ee4abeb30
Signed-off-by: Ivan Iskandar <ivan@prjkt.io>
Signed-off-by: Nicholas Chum <nicholas@prjkt.io>
Signed-off-by: Harsh Shandilya <harsh@prjkt.io>
Signed-off-by: VenkatVishalV <venkatvishal124@gmail.com>
  • Loading branch information
ivaniskandar authored and VenkatVishalV committed Nov 10, 2018
1 parent 8ec1689 commit 5251d7b
Show file tree
Hide file tree
Showing 18 changed files with 1,864 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ java_library {
"core/java/android/content/pm/dex/IArtManager.aidl",
"core/java/android/content/pm/dex/ISnapshotRuntimeProfileCallback.aidl",
"core/java/android/content/pm/permission/IRuntimePermissionPresenter.aidl",
"core/java/android/content/substratum/ISubstratumService.aidl",
"core/java/android/database/IContentObserver.aidl",
":libcamera_client_aidl",
":libcamera_client_framework_aidl",
Expand Down Expand Up @@ -389,6 +390,7 @@ java_library {
"core/java/com/android/internal/os/IShellCallback.aidl",
"core/java/com/android/internal/statusbar/IStatusBar.aidl",
"core/java/com/android/internal/statusbar/IStatusBarService.aidl",
"core/java/com/android/internal/substratum/ISubstratumHelperService.aidl",
"core/java/com/android/internal/textservice/ISpellCheckerService.aidl",
"core/java/com/android/internal/textservice/ISpellCheckerServiceCallback.aidl",
"core/java/com/android/internal/textservice/ISpellCheckerSession.aidl",
Expand Down
144 changes: 144 additions & 0 deletions core/java/android/content/substratum/ISubstratumService.aidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/*
* Copyright (C) 2018 Projekt Substratum
*
* 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 android.content.substratum;

interface ISubstratumService {

/**
* Install a list of specified overlay packages
*
* @param paths Filled in with a list of path names for packages to be installed from.
*/
void installOverlay(in List<String> paths);

/**
* Uninstall a list of specified overlay packages
*
* @param packages Filled in with a list of path names for packages to be installed from.
* @param restartUi Flag to automatically restart the SystemUI.
*/
void uninstallOverlay(in List<String> packages, boolean restartUi);

/**
* Switch the state of specified overlay packages
*
* @param packages Filled in with a list of package names to be switched.
* @param enable Whether to enable the specified overlays.
* @param restartUi Flag to automatically restart the SystemUI.
*/
void switchOverlay(in List<String> packages, boolean enable, boolean restartUi);

/**
* Change the priority of a specified list of overlays
*
* @param packages Filled in with a list of package names to be reordered.
* @param restartUi Flag to automatically restart the SystemUI.
*/
void setPriority(in List<String> packages, boolean restartUi);

/**
* Restart SystemUI
*/
void restartSystemUI();

/**
* Copy Method
*
* @param source Path of the source file.
* @param destination Path of the source file to be copied to.
*/
void copy(String source, String destination);

/**
* Move Method
*
* @param source Path of the source file.
* @param destination Path of the source file to be moved to.
*/
void move(String source, String destination);

/**
* Create Directory Method
*
* @param destination Path of the created destination folder.
*/
void mkdir(String destination);

/**
* Delete Directory Method
*
* @param destination Path of the directory to be deleted.
* @param withParent Flag to automatically delete the folder encompassing the folder.
*/
void deleteDirectory(String directory, boolean withParent);

/**
* Apply a specified bootanimation
*
* @param name Path to extract the bootanimation archive from.
*/
void applyBootanimation(String name);

/**
* Apply a specified font pack
*
* @param name Path to extract the font archive from.
*/
void applyFonts(String pid, String fileName);

/**
* Apply a specified sound pack
*
* @param name Path to extract the sounds archive from.
*/
void applySounds(String pid, String fileName);

/**
* Profile Applicator
*
* @param enable Filled in with a list of package names to be enabled.
* @param disable Filled in with a list of package names to be disabled.
* @param name Name of the profile to be applied.
* @param restartUi Flag to automatically restart the SystemUI.
*/
void applyProfile(in List<String> enable, in List<String> disable, String name,
boolean restartUi);

/**
* Apply a specified shutdownanimation
*
* @param name Path to extract the shutdown archive from.
* Use null to clear applied custom shutdown
*/
void applyShutdownAnimation(String name);

/**
* Returns information about all installed overlay packages for the
* specified user. If there are no installed overlay packages for this user,
* an empty map is returned (i.e. null is never returned). The returned map is a
* mapping of target package names to lists of overlays. Each list for a
* given target package is sorted in priority order, with the overlay with
* the highest priority at the end of the list.
*
* @param uid The user to get the OverlayInfos for.
* @return A Map<String, List<OverlayInfo>> with target package names
* mapped to lists of overlays; if no overlays exist for the
* requested user, an empty map is returned.
*/
Map getAllOverlays(in int uid);
}

7 changes: 7 additions & 0 deletions core/java/android/provider/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -9592,6 +9592,13 @@ public boolean validate(@Nullable String value) {
*/
public static final String LOCKSCREEN_VISUALIZER_ENABLED = "lockscreen_visualizer_enabled";

/**
* Force authorize Substratum (or equivalent) frontend calling packages by ThemeInterfacer
* The value is boolean (1 or 0).
* @hide
*/
public static final String FORCE_AUTHORIZE_SUBSTRATUM_PACKAGES = "force_authorize_substratum_packages";

/**
* This are the settings to be backed up.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (C) 2018 Projekt Substratum
*
* 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.internal.substratum;

oneway interface ISubstratumHelperService {
void applyBootAnimation();
void applyShutdownAnimation();
void applyProfile(in String name);
}
3 changes: 3 additions & 0 deletions core/res/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,9 @@
<!-- For IdleController -->
<protected-broadcast android:name="android.intent.action.DOCK_IDLE" />
<protected-broadcast android:name="android.intent.action.DOCK_ACTIVE" />
<protected-broadcast android:name="projekt.substratum.APP_CRASHED" />
<protected-broadcast android:name="com.android.systemui.action.RESTART_THEME" />
<protected-broadcast android:name="com.android.systemui.action.REFRESH_SOUND" />

<!-- Used for long press power torch feature - automatic turn off on timeout -->
<protected-broadcast android:name="com.android.server.policy.PhoneWindowManager.ACTION_TORCH_OFF" />
Expand Down
8 changes: 8 additions & 0 deletions data/etc/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,11 @@ LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/sysconfig
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := projekt.substratum.theme.xml
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
25 changes: 25 additions & 0 deletions data/etc/projekt.substratum.theme.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2018 Project Substratum
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.
-->

<permissions>
<!-- Limitation permission to block out themes from being visible on stock
AOSP, or non-OMS devices. -->

<!-- This is an alias for projekt.substratum.theme -->
<feature name="projekt.substratum.theme" />

</permissions>
Original file line number Diff line number Diff line change
Expand Up @@ -1631,7 +1631,6 @@ public boolean filterApp(AppEntry entry) {
return false;
}
};

public static final AppFilter FILTER_DISABLED = new AppFilter() {
@Override
public void init() {
Expand Down
31 changes: 31 additions & 0 deletions packages/SubstratumService/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Copyright (C) 2018 Projekt Substratum
#
# 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.
#

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_REQUIRED_MODULES := projekt.substratum.theme.xml
LOCAL_PACKAGE_NAME := SubstratumService
LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true

include $(BUILD_PACKAGE)

44 changes: 44 additions & 0 deletions packages/SubstratumService/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
* Copyright (c) 2018 Projekt Substratum
*
* 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.
*/
-->


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.substratum.service"
android:sharedUserId="android.uid.system"
android:versionCode="1"
android:versionName="one" >

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application
android:allowBackup="false"
android:label="Substratum Service">

<service android:name="android.substratum.service.SubstratumHelperService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.substratum.service.SubstratumHelperService" />
</intent-filter>
</service>

</application>

</manifest>

0 comments on commit 5251d7b

Please sign in to comment.