sdm660-common: introduce clover parts

* implemented volume panel trigger in QS
* we may need to implement some extra function like multiwindow
* the seapp_context may need a diffrent entity from DeviceSettings to avoid neverallow

Signed-off-by: pix106 <sbordenave@gmail.com>
This commit is contained in:
Alcatraz323 2023-04-12 16:50:29 +08:00 committed by pix106
parent 3bf23bb2d7
commit 5b660f6800
8 changed files with 163 additions and 0 deletions

21
CloverParts/Android.bp Normal file
View file

@ -0,0 +1,21 @@
//
// Copyright (C) 2023 Alcatraz323 <alcatraz32323@gmail.com>
//
// SPDX-License-Identifier: Apache-2.0
//
android_app {
name: "CloverParts",
srcs: ["src/**/*.java"],
resource_dirs: ["res"],
certificate: "platform",
platform_apis: true,
system_ext_specific: true,
privileged: true,
optimize: {
proguard_flags_files: ["proguard.flags"],
},
}

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023 Alcatraz323 <alcatraz32323@gmail.com>
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"
coreApp="true"
package="io.alcatraz.cloverparts"
android:sharedUserId="android.uid.system">
<application
android:directBootAware="true"
android:label="@string/app_name">
<service
android:enabled="true"
android:exported="true"
android:name="io.alcatraz.cloverparts.VolumePanelTileService"
android:icon="@drawable/ic_speaker_cleaner_icon"
android:label="@string/volume_panel_trigger_title"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action
android:name="android.service.quicksettings.action.QS_TILE"/>
</intent-filter>
</service>
</application>
</manifest>

View file

@ -0,0 +1,3 @@
-keep class io.alcatraz.cloverparts.* {
*;
}

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:tint="?android:attr/colorControlNormal"
android:viewportHeight="24">
<path
android:pathData="M0 0h24v24H0z" />
<path
android:fillColor="#FFFFFFFF"
android:pathData="M20 4H4c-1.1 0-2 0.9-2 2v12c0 1.1 0.9 2 2 2h16c1.1 0 2-0.9 2-2V6c0-1.1-0.9-2-2-2zM7.76 16.24l-1.41 1.41C4.78 16.1 4 14.05 4 12c0-2.05 0.78 -4.1 2.34-5.66l1.41 1.41C6.59 8.93 6 10.46 6 12s0.59 3.07 1.76 4.24zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm5.66 1.66l-1.41-1.41C17.41 15.07 18 13.54 18 12s-0.59-3.07-1.76-4.24l1.41-1.41C19.22 7.9 20 9.95 20 12c0 2.05-0.78 4.1-2.34 5.66zM12 10c-1.1 0-2 0.9-2 2s0.9 2 2 2 2-0.9 2-2-0.9-2-2-2z" />
</vector>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023 Alcatraz323 <alcatraz32323@gmail.com>
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>
<string name="app_name">平板扩展</string>
<string name="volume_panel_trigger_title">音量面板</string>
</resources>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023 Alcatraz323 <alcatraz32323@gmail.com>
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>
<string name="app_name">Clover Parts</string>
<string name="volume_panel_trigger_title">Volume Panel</string>
</resources>

View file

@ -0,0 +1,41 @@
/**
* Copyright (C) 2023 Alcatraz323 <alcatraz32323@gmail.com>
*
* 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 io.alcatraz.cloverparts;
import android.content.Context;
import android.media.AudioManager;
import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService;
public class VolumePanelTileService extends TileService {
public VolumePanelTileService() { }
@Override
public void onStartListening() {
super.onStartListening();
final Tile tile = getQsTile();
tile.setState(Tile.STATE_ACTIVE);
tile.updateTile();
}
@Override
public void onClick() {
AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audio.adjustStreamVolume(AudioManager.STREAM_MUSIC,
AudioManager.ADJUST_SAME, AudioManager.FLAG_SHOW_UI);
}
}

View file

@ -137,6 +137,10 @@ PRODUCT_PACKAGES += \
vendor.qti.hardware.capabilityconfigstore@1.0 \
vendor.qti.hardware.capabilityconfigstore@1.0.vendor
# Clover parts
PRODUCT_PACKAGES += \
CloverParts
# Codec2 modules
PRODUCT_PACKAGES += \
com.android.media.swcodec \