diff --git a/CloverParts/Android.bp b/CloverParts/Android.bp new file mode 100644 index 00000000..2f82f59c --- /dev/null +++ b/CloverParts/Android.bp @@ -0,0 +1,21 @@ +// +// Copyright (C) 2023 Alcatraz323 +// +// 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"], + }, + +} diff --git a/CloverParts/AndroidManifest.xml b/CloverParts/AndroidManifest.xml new file mode 100644 index 00000000..3000941a --- /dev/null +++ b/CloverParts/AndroidManifest.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + diff --git a/CloverParts/proguard.flags b/CloverParts/proguard.flags new file mode 100644 index 00000000..a63db6a7 --- /dev/null +++ b/CloverParts/proguard.flags @@ -0,0 +1,3 @@ +-keep class io.alcatraz.cloverparts.* { + *; +} diff --git a/CloverParts/res/drawable/ic_speaker_cleaner_icon.xml b/CloverParts/res/drawable/ic_speaker_cleaner_icon.xml new file mode 100644 index 00000000..4ef1f6d9 --- /dev/null +++ b/CloverParts/res/drawable/ic_speaker_cleaner_icon.xml @@ -0,0 +1,14 @@ + + + + + + diff --git a/CloverParts/res/values-zh-rCN/strings.xml b/CloverParts/res/values-zh-rCN/strings.xml new file mode 100644 index 00000000..03f7a379 --- /dev/null +++ b/CloverParts/res/values-zh-rCN/strings.xml @@ -0,0 +1,20 @@ + + + + 平板扩展 + 音量面板 + diff --git a/CloverParts/res/values/strings.xml b/CloverParts/res/values/strings.xml new file mode 100644 index 00000000..595365bb --- /dev/null +++ b/CloverParts/res/values/strings.xml @@ -0,0 +1,20 @@ + + + + Clover Parts + Volume Panel + diff --git a/CloverParts/src/io/alcatraz/cloverparts/VolumePanelTileService.java b/CloverParts/src/io/alcatraz/cloverparts/VolumePanelTileService.java new file mode 100644 index 00000000..4f476369 --- /dev/null +++ b/CloverParts/src/io/alcatraz/cloverparts/VolumePanelTileService.java @@ -0,0 +1,41 @@ +/** + * Copyright (C) 2023 Alcatraz323 + * + * 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); + } +} diff --git a/sdm660.mk b/sdm660.mk index 0aa41e36..f53dfc21 100644 --- a/sdm660.mk +++ b/sdm660.mk @@ -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 \