(tagName)
49 | if (null == r) MLog.e(TAG, "can not find tag $tagName in $layout")
50 | r
51 | } catch (e: Exception) {
52 | e.printStackTrace()
53 | MLog.e(TAG, "getLayoutChildViewByTag", e)
54 | null
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/freeform-server/src/main/java/io/sunshine0523/freeform/ui/freeform/RotationWatcher.kt:
--------------------------------------------------------------------------------
1 | package io.sunshine0523.freeform.ui.freeform
2 |
3 | import android.view.IRotationWatcher
4 |
5 | /**
6 | * Default Display Rotation Listener
7 | */
8 | class RotationWatcher(private val window: FreeformWindow): IRotationWatcher.Stub() {
9 |
10 | override fun onRotationChanged(rotation: Int) {
11 | window.defaultDisplayWidth = window.context.resources.displayMetrics.widthPixels
12 | window.defaultDisplayHeight = window.context.resources.displayMetrics.heightPixels
13 | window.handler.post {
14 | if (window.freeformConfig.isHangUp) window.toHangUp()
15 | else window.makeSureFreeformInScreen()
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/freeform-server/src/main/java/io/sunshine0523/freeform/ui/freeform/UIConfig.kt:
--------------------------------------------------------------------------------
1 | package io.sunshine0523.freeform.ui.freeform
2 |
3 | data class UIConfig(
4 | val resPkg: String,
5 | val layoutName: String
6 | )
--------------------------------------------------------------------------------
/freeform-server/src/main/java/io/sunshine0523/freeform/ui/sidebar/MGestureManager.kt:
--------------------------------------------------------------------------------
1 | package io.sunshine0523.freeform.ui.sidebar
2 |
3 | import android.content.Context
4 | import android.view.GestureDetector
5 | import android.view.MotionEvent
6 | import android.view.GestureDetector.SimpleOnGestureListener
7 | import kotlin.math.abs
8 |
9 | class MGestureManager(context: Context, private val mListener: MGestureListener) {
10 | private val mGestureDetector: GestureDetector
11 | private val minVelocity = 50
12 |
13 | companion object {
14 | private const val TAG = "MGestureManager"
15 | }
16 |
17 | interface MGestureListener {
18 | fun singleFingerSlipAction(
19 | gestureEvent: GestureEvent?,
20 | startEvent: MotionEvent?,
21 | endEvent: MotionEvent?,
22 | velocity: Float
23 | ): Boolean
24 | }
25 |
26 | enum class GestureEvent {
27 | SINGLE_GINGER_LEFT_SLIP, SINGLE_GINGER_RIGHT_SLIP, SINGLE_GINGER_UP_SLIP, SINGLE_GINGER_DOWN_SLIP
28 | }
29 |
30 | fun onTouchEvent(event: MotionEvent): Boolean {
31 | return mGestureDetector.onTouchEvent(event)
32 | }
33 |
34 | private inner class SimpleGesture : SimpleOnGestureListener() {
35 | override fun onFling(
36 | e1: MotionEvent?, e2: MotionEvent, velocityX: Float,
37 | velocityY: Float
38 | ): Boolean {
39 | if (null == e1) return false
40 | if (e1.x - e2.x > 0 && abs((e1.x - e2.x).toInt()) > abs((e1.y - e2.y).toInt()) && abs(velocityX) > minVelocity) {
41 | return mListener.singleFingerSlipAction(
42 | GestureEvent.SINGLE_GINGER_LEFT_SLIP,
43 | e1,
44 | e2,
45 | abs(velocityX)
46 | )
47 | }
48 | else if (e1.x - e2.x < 0 && abs((e1.x - e2.x).toInt()) > abs((e1.y - e2.y).toInt()) && abs(velocityX) > minVelocity) {
49 | return mListener.singleFingerSlipAction(
50 | GestureEvent.SINGLE_GINGER_RIGHT_SLIP,
51 | e1,
52 | e2,
53 | abs(velocityX)
54 | )
55 | } else if (e1.y - e2.y > 0 && abs((e1.y - e2.y).toInt()) > abs((e1.x - e2.x).toInt()) && abs(
56 | velocityY
57 | ) > minVelocity
58 | ) {
59 | return mListener.singleFingerSlipAction(
60 | GestureEvent.SINGLE_GINGER_UP_SLIP,
61 | e1,
62 | e2,
63 | abs(velocityY)
64 | )
65 | } else if (e1.y - e2.y < 0 && abs((e1.y - e2.y).toInt()) > abs((e1.x - e2.x).toInt()) && abs(
66 | velocityY
67 | ) > minVelocity
68 | ) {
69 | return mListener.singleFingerSlipAction(
70 | GestureEvent.SINGLE_GINGER_DOWN_SLIP,
71 | e1,
72 | e2,
73 | abs(velocityY)
74 | )
75 | } else return true
76 | }
77 | }
78 |
79 | init {
80 | mGestureDetector =
81 | GestureDetector(context, SimpleGesture(), null, true)
82 | }
83 | }
--------------------------------------------------------------------------------
/freeform-server/src/main/java/io/sunshine0523/freeform/ui/sidebar/SideBarTouchListener.kt:
--------------------------------------------------------------------------------
1 | package io.sunshine0523.freeform.ui.sidebar
2 |
3 | import android.annotation.SuppressLint
4 | import android.content.ComponentName
5 | import android.content.Intent
6 | import android.util.Log
7 | import android.view.MotionEvent
8 | import android.view.View
9 | import io.sunshine0523.freeform.util.MLog
10 |
11 | /**
12 | * @author KindBrave
13 | * @since 2023/8/23
14 | */
15 | @SuppressLint("ClickableViewAccessibility")
16 | class SideBarTouchListener(private val sideBarWindow: SideBarWindow) {
17 | companion object {
18 | private const val TAG = "Mi-Freeform/SideBarTouchListener"
19 | }
20 | init {
21 | sideBarWindow.uiHandler.post {
22 | val leftGestureManager = MGestureManager(sideBarWindow.context, LeftListener())
23 | val rightGestureManager = MGestureManager(sideBarWindow.context, RightListener())
24 | val leftTouchListener = View.OnTouchListener { _, e ->
25 | leftGestureManager.onTouchEvent(e)
26 | true
27 | }
28 | val rightTouchListener = View.OnTouchListener { _, e ->
29 | rightGestureManager.onTouchEvent(e)
30 | true
31 | }
32 | sideBarWindow.leftView.setOnTouchListener(leftTouchListener)
33 | sideBarWindow.rightView.setOnTouchListener(rightTouchListener)
34 | }
35 | }
36 |
37 | inner class LeftListener : MGestureManager.MGestureListener {
38 | override fun singleFingerSlipAction(
39 | gestureEvent: MGestureManager.GestureEvent?,
40 | startEvent: MotionEvent?,
41 | endEvent: MotionEvent?,
42 | velocity: Float
43 | ): Boolean {
44 | if (null != gestureEvent) {
45 | val intent = Intent().apply {
46 | component = ComponentName("com.sunshine.freeform", "com.sunshine.freeform.ui.floating.FloatingActivity")
47 | addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
48 | action = Intent.ACTION_MAIN
49 | addCategory(Intent.CATEGORY_LAUNCHER)
50 | putExtra("isLeft", true)
51 | }
52 | runCatching { sideBarWindow.context.startActivity(intent) }.onFailure { MLog.e(TAG, "$it") }
53 | return true
54 | }
55 | return true
56 | }
57 | }
58 |
59 | inner class RightListener : MGestureManager.MGestureListener {
60 | override fun singleFingerSlipAction(
61 | gestureEvent: MGestureManager.GestureEvent?,
62 | startEvent: MotionEvent?,
63 | endEvent: MotionEvent?,
64 | velocity: Float
65 | ): Boolean {
66 | if (null != gestureEvent) {
67 | val intent = Intent().apply {
68 | component = ComponentName("com.sunshine.freeform", "com.sunshine.freeform.ui.floating.FloatingActivity")
69 | addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
70 | action = Intent.ACTION_MAIN
71 | addCategory(Intent.CATEGORY_LAUNCHER)
72 | putExtra("isLeft", false)
73 | }
74 | runCatching { sideBarWindow.context.startActivity(intent) }.onFailure { MLog.e(TAG, "$it") }
75 | return true
76 | }
77 | return false
78 | }
79 | }
80 | }
--------------------------------------------------------------------------------
/freeform-server/src/main/java/io/sunshine0523/freeform/ui/sidebar/SideBarWindow.kt:
--------------------------------------------------------------------------------
1 | package io.sunshine0523.freeform.ui.sidebar
2 |
3 | import android.annotation.SuppressLint
4 | import android.content.Context
5 | import android.graphics.Color
6 | import android.graphics.PixelFormat
7 | import android.os.Handler
8 | import android.view.Display
9 | import android.view.IRotationWatcher
10 | import android.view.View
11 | import android.view.WindowManager
12 | import android.view.WindowManagerHidden
13 | import io.sunshine0523.freeform.service.SystemServiceHolder
14 | import io.sunshine0523.freeform.util.MLog
15 | /**
16 | * @author KindBrave
17 | * @since 2023/8/22
18 | */
19 | class SideBarWindow(
20 | val context: Context,
21 | val uiHandler: Handler
22 | ) : IRotationWatcher.Stub() {
23 | private val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
24 | private val leftWindowParams = WindowManagerHidden.LayoutParams()
25 | private val rightWindowParams = WindowManagerHidden.LayoutParams()
26 | lateinit var leftView: View
27 | lateinit var rightView: View
28 |
29 | companion object {
30 | private const val TAG = "Mi-Freeform/SideBarWindow"
31 | }
32 |
33 | init {
34 | addSideBarView()
35 | SystemServiceHolder.windowManager.watchRotation(this, Display.DEFAULT_DISPLAY)
36 | }
37 |
38 | override fun onRotationChanged(rotation: Int) {
39 | destroy()
40 | addSideBarView(false)
41 | }
42 |
43 | @SuppressLint("ClickableViewAccessibility")
44 | private fun addSideBarView(needUpdateColor: Boolean = true) {
45 | val screenWidth = context.resources.displayMetrics.widthPixels
46 | val screenHeight = context.resources.displayMetrics.heightPixels
47 | uiHandler.post {
48 | leftView = View(context)
49 | rightView = View(context)
50 | leftView.setBackgroundColor(Color.TRANSPARENT)
51 | rightView.setBackgroundColor(Color.TRANSPARENT)
52 | SideBarTouchListener(this)
53 | leftWindowParams.apply {
54 | type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY
55 | width = 100
56 | height = screenHeight / 5
57 | x = -screenWidth / 2
58 | y = -screenHeight / 6
59 | flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or
60 | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or
61 | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS or
62 | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
63 | privateFlags = WindowManagerHidden.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS or WindowManagerHidden.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY or WindowManagerHidden.LayoutParams.PRIVATE_FLAG_USE_BLAST or WindowManagerHidden.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY
64 | format = PixelFormat.RGBA_8888
65 | }
66 | rightWindowParams.apply {
67 | type = 2026
68 | width = 100
69 | height = screenHeight / 5
70 | x = screenWidth / 2
71 | y = -screenHeight / 6
72 | flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or
73 | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or
74 | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS or
75 | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
76 | privateFlags = WindowManagerHidden.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS or WindowManagerHidden.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY or WindowManagerHidden.LayoutParams.PRIVATE_FLAG_USE_BLAST or WindowManagerHidden.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY
77 | format = PixelFormat.RGBA_8888
78 | }
79 | uiHandler.post {
80 | runCatching {
81 | windowManager.addView(leftView, leftWindowParams)
82 | windowManager.addView(rightView, rightWindowParams)
83 |
84 | if (needUpdateColor) {
85 | updateSideBarColor(Color.BLUE)
86 | Thread {
87 | Thread.sleep(3000L)
88 | uiHandler.post { runCatching { updateSideBarColor(Color.TRANSPARENT) } }
89 | }.start()
90 | }
91 | }.onFailure {
92 | MLog.e(TAG, "$it")
93 | }
94 | }
95 | }
96 | }
97 |
98 | /**
99 | * Called in uiHandler
100 | */
101 | private fun updateSideBarColor(color: Int) {
102 | leftView.setBackgroundColor(color)
103 | rightView.setBackgroundColor(color)
104 | windowManager.updateViewLayout(leftView, leftWindowParams)
105 | windowManager.updateViewLayout(rightView, rightWindowParams)
106 | }
107 |
108 | fun destroy() {
109 | SystemServiceHolder.windowManager.removeRotationWatcher(this)
110 | uiHandler.post {
111 | runCatching {
112 | windowManager.removeViewImmediate(leftView)
113 | windowManager.removeViewImmediate(rightView)
114 | }
115 | }
116 | }
117 | }
--------------------------------------------------------------------------------
/freeform-server/src/main/java/io/sunshine0523/freeform/util/DataHelper.kt:
--------------------------------------------------------------------------------
1 | package io.sunshine0523.freeform.util
2 |
3 | import android.os.Environment
4 | import android.util.Log
5 | import com.google.gson.Gson
6 | import java.io.File
7 | import java.lang.StringBuilder
8 |
9 | object DataHelper {
10 | private const val TAG = "Mi-Freeform/DataHelper"
11 | private val dataDir = File("${Environment.getDataDirectory()}/system/mi_freeform")
12 | private val dataFile = File(dataDir, "settings.json")
13 | private val logFile = File(dataDir, "log.log")
14 | private val gson = Gson()
15 | private var settings: Settings? = null
16 | private val logs = StringBuilder()
17 |
18 | init {
19 | runCatching {
20 | dataDir.mkdir()
21 | dataFile.createNewFile()
22 | logFile.createNewFile()
23 |
24 | Thread {
25 | runCatching {
26 | logFile.writeText("")
27 | }
28 | }.start()
29 | }.onFailure {
30 | MLog.e(TAG, "$it $dataDir")
31 | }
32 | }
33 |
34 | fun getSettings(): Settings {
35 | if (null == settings) {
36 | settings = runCatching {
37 | gson.fromJson(dataFile.readText(), Settings::class.java) ?: Settings()
38 | }.getOrElse {
39 | Settings()
40 | }
41 | }
42 | return settings!!
43 | }
44 |
45 | fun getSettingsString(): String {
46 | return gson.toJson(getSettings())
47 | }
48 |
49 | fun saveSettings(settings: Settings) {
50 | this.settings = settings
51 | runCatching {
52 | dataFile.writeText(gson.toJson(settings))
53 | }
54 | }
55 |
56 | fun saveSettings(settings: String, listener: DataChangeListener) {
57 | runCatching {
58 | this.settings = gson.fromJson(settings, Settings::class.java) ?: this.settings
59 | dataFile.writeText(settings)
60 | listener.onChanged()
61 | }
62 | }
63 |
64 | fun getLog(): String {
65 | return logs.toString()
66 | }
67 |
68 | fun appendLog(log: String) {
69 | Thread {
70 | runCatching {
71 | logs.append(log).append("\n")
72 | logFile.appendText("$log\n")
73 | }
74 | }.start()
75 | }
76 |
77 | fun clearLog() {
78 | Thread {
79 | runCatching {
80 | logs.clear()
81 | logFile.writeText("")
82 | }
83 | }.start()
84 | }
85 | }
86 |
87 | interface DataChangeListener {
88 | fun onChanged()
89 | }
--------------------------------------------------------------------------------
/freeform-server/src/main/java/io/sunshine0523/freeform/util/MLog.java:
--------------------------------------------------------------------------------
1 | package io.sunshine0523.freeform.util;
2 |
3 | import android.util.Log;
4 |
5 | import java.io.PrintWriter;
6 | import java.io.StringWriter;
7 |
8 | public class MLog {
9 | public static void i(String tag, String message) {
10 | Log.i(tag, message);
11 | DataHelper.INSTANCE.appendLog("[i] " + tag + " " + message);
12 | }
13 |
14 | public static void w(String tag, String message) {
15 | Log.w(tag, message);
16 | DataHelper.INSTANCE.appendLog("[w] " + tag + " " + message);
17 | }
18 |
19 | public static void e(String tag, String message) {
20 | Log.e(tag, message);
21 | DataHelper.INSTANCE.appendLog("[e] " + tag + " " + message);
22 | }
23 |
24 | public static void e(String tag, String message, Exception e) {
25 | StringWriter writer = new StringWriter();
26 | PrintWriter printWriter = new PrintWriter(writer);
27 | e.printStackTrace(printWriter);
28 | Throwable cause = e.getCause();
29 | while (cause != null) {
30 | cause.printStackTrace(printWriter);
31 | cause = cause.getCause();
32 | }
33 | printWriter.close();
34 | String result = writer.toString();
35 |
36 | Log.e(tag, result);
37 | DataHelper.INSTANCE.appendLog("[e] " + tag + " " + message + " " + result);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/freeform-server/src/main/java/io/sunshine0523/freeform/util/Settings.kt:
--------------------------------------------------------------------------------
1 | package io.sunshine0523.freeform.util
2 |
3 | data class Settings(
4 | var enableSideBar: Boolean = false,
5 | var showImeInFreeform: Boolean = false,
6 | var notification: Boolean = false
7 | )
--------------------------------------------------------------------------------
/freeform-server/src/test/java/io/sunshine0523/freeform/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.sunshine.freeform
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 |
18 |
19 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Kotlin code style for this project: "official" or "obsolete":
19 | kotlin.code.style=official
20 | # Enables namespacing of each library's R class so that its R class includes only the
21 | # resources declared in the library itself and none from the library's dependencies,
22 | # thereby reducing the size of the R class for that library
23 | android.nonTransitiveRClass=true
--------------------------------------------------------------------------------
/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | [versions]
2 | agp = "8.1.1"
3 | kotlin = "1.8.10"
4 | zygote-loader = "3.0"
5 | core-ktx = "1.10.1"
6 | ksp = "1.8.10-1.0.9"
7 | junit = "4.13.2"
8 | androidx-test-ext-junit = "1.1.5"
9 | espresso-core = "3.5.1"
10 | lifecycle-runtime-ktx = "2.6.1"
11 | lifecycle-viewmodel-ktx = "2.1.0"
12 | activity-compose = "1.7.0"
13 | compose-bom = "2023.03.00"
14 | androidx-appcompat-appcompat = "1.6.1"
15 | constraintlayout = "2.1.4"
16 | com-google-android-material-material = "1.9.0"
17 | hidden-api-bypass = "4.3"
18 | magic-library = "1.5"
19 | hidden-api-refine = "4.3.0"
20 | foundation = "1.4.0"
21 | systemuicontroller = "0.33.0-alpha"
22 | gson = "2.10.1"
23 | room = "2.5.1"
24 | glide = "4.16.0"
25 | drawablepainter = "0.32.0"
26 | compose-livedata = "1.4.3"
27 | nativehelper = "1.0.0"
28 | cxx = "1.2.0"
29 | navigation-fragment-ktx = "2.5.3"
30 | navigation-ui-ktx = "2.5.3"
31 | rikka-appcompat = "1.2.0-rc01"
32 | rikka-material = "1.6.6"
33 |
34 | [libraries]
35 | core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "core-ktx" }
36 | lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle-runtime-ktx" }
37 | lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycle-viewmodel-ktx" }
38 | activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activity-compose" }
39 | appcompat = { group = "dev.rikka.rikkax.appcompat", name = "appcompat", version.ref = "rikka-appcompat" }
40 |
41 | constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
42 |
43 | junit = { group = "junit", name = "junit", version.ref = "junit" }
44 | androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-ext-junit" }
45 | espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso-core" }
46 |
47 | compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" }
48 | ui = { group = "androidx.compose.ui", name = "ui" }
49 | ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
50 | ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
51 | ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
52 | ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
53 | ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
54 | compose-material3 = { group = "androidx.compose.material3", name = "material3" }
55 | compose-foundation = { group = "androidx.compose.foundation", name = "foundation", version.ref = "foundation"}
56 | compose-livedata = { group = "androidx.compose.runtime", name = "runtime-livedata", version.ref = "compose-livedata" }
57 |
58 | room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room"}
59 | room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "room"}
60 | room-ktx = { group = "androidx.room", name = "room-ktx", version.ref = "room"}
61 |
62 | material = { group = "dev.rikka.rikkax.material", name = "material", version.ref = "rikka-material" }
63 |
64 | systemuicontroller = { group = "com.google.accompanist", name = "accompanist-systemuicontroller", version.ref = "systemuicontroller"}
65 |
66 | hiddenapibypass = { module = "org.lsposed.hiddenapibypass:hiddenapibypass", version.ref = "hidden-api-bypass" }
67 |
68 | magic-library = { group = "com.github.kr328.magic", name = "library", version.ref = "magic-library"}
69 |
70 | hiddenapirefineannotationprocessor = { group = "dev.rikka.tools.refine", name = "annotation-processor", version.ref = "hidden-api-refine"}
71 | hiddenapirefineannotation = { group = "dev.rikka.tools.refine", name = "annotation", version.ref = "hidden-api-refine"}
72 | hiddenapirefineruntime = { group = "dev.rikka.tools.refine", name = "runtime", version.ref = "hidden-api-refine"}
73 |
74 | gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
75 |
76 | glide = { group = "com.github.bumptech.glide", name = "glide", version.ref = "glide" }
77 |
78 | drawablepainter = { group = "com.google.accompanist", name = "accompanist-drawablepainter", version.ref = "drawablepainter" }
79 |
80 | nativehelper = { group = "dev.rikka.ndk.thirdparty", name = "nativehelper", version.ref = "nativehelper" }
81 | cxx = { group = "dev.rikka.ndk.thirdparty", name = "cxx", version.ref = "cxx" }
82 | [plugins]
83 | androidApplication = { id = "com.android.application", version.ref = "agp" }
84 | androidLibrary = { id = "com.android.library", version.ref = "agp" }
85 | kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
86 | hiddenApiRefine = { id = "dev.rikka.tools.refine", version.ref = "hidden-api-refine" }
87 | zygoteLoader = { id = "com.github.kr328.gradle.zygote", version.ref = "zygote-loader"}
88 | ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
89 |
90 | [bundles]
91 |
92 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine0523/Mi-Freeform/0a078b385fbd12d4bfd83dbe905e8eaa62ac36c1/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Aug 28 17:33:47 CST 2023
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/hidden-api/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/hidden-api/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | alias(libs.plugins.androidLibrary)
3 | }
4 |
5 | android {
6 | namespace = "io.sunshine0523.hidden_api"
7 | }
8 |
9 | dependencies {
10 | annotationProcessor(libs.hiddenapirefineannotationprocessor)
11 | compileOnly(libs.hiddenapirefineannotation)
12 | }
--------------------------------------------------------------------------------
/hidden-api/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine0523/Mi-Freeform/0a078b385fbd12d4bfd83dbe905e8eaa62ac36c1/hidden-api/consumer-rules.pro
--------------------------------------------------------------------------------
/hidden-api/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/hidden-api/src/androidTest/java/io/sunshine0523/hidden/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package io.sunshine0523.hidden
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("io.sunshine0523.hidden.test", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/hidden-api/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/annotation/NonNull.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package android.annotation;
17 |
18 | import static java.lang.annotation.ElementType.FIELD;
19 | import static java.lang.annotation.ElementType.METHOD;
20 | import static java.lang.annotation.ElementType.PARAMETER;
21 | import static java.lang.annotation.RetentionPolicy.SOURCE;
22 |
23 | import java.lang.annotation.Retention;
24 | import java.lang.annotation.Target;
25 |
26 | /**
27 | * Denotes that a parameter, field or method return value can never be null.
28 | *
29 | * This is a marker annotation and it has no specific attributes.
30 | *
31 | * @paramDoc This value must never be {@code null}.
32 | * @returnDoc This value will never be {@code null}.
33 | * @hide
34 | */
35 | @Retention(SOURCE)
36 | @Target({METHOD, PARAMETER, FIELD})
37 | public @interface NonNull {
38 | }
39 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/annotation/Nullable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package android.annotation;
17 |
18 | import static java.lang.annotation.ElementType.FIELD;
19 | import static java.lang.annotation.ElementType.METHOD;
20 | import static java.lang.annotation.ElementType.PARAMETER;
21 | import static java.lang.annotation.RetentionPolicy.SOURCE;
22 |
23 | import java.lang.annotation.Retention;
24 | import java.lang.annotation.Target;
25 |
26 | /**
27 | * Denotes that a parameter, field or method return value can be null.
28 | *
29 | * When decorating a method call parameter, this denotes that the parameter can
30 | * legitimately be null and the method will gracefully deal with it. Typically
31 | * used on optional parameters.
32 | *
33 | * When decorating a method, this denotes the method might legitimately return
34 | * null.
35 | *
36 | * This is a marker annotation and it has no specific attributes.
37 | *
38 | * @paramDoc This value may be {@code null}.
39 | * @returnDoc This value may be {@code null}.
40 | */
41 | @Retention(SOURCE)
42 | @Target({METHOD, PARAMETER, FIELD})
43 | public @interface Nullable {
44 | }
45 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/app/ActivityManagerHidden.java:
--------------------------------------------------------------------------------
1 | package android.app;
2 |
3 | import dev.rikka.tools.refine.RefineAs;
4 |
5 | @RefineAs(ActivityManager.class)
6 | public class ActivityManagerHidden {
7 | public static class TaskSnapshot {
8 |
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/app/ActivityOptionsHidden.java:
--------------------------------------------------------------------------------
1 | package android.app;
2 |
3 | import android.os.Bundle;
4 |
5 | import dev.rikka.tools.refine.RefineAs;
6 |
7 | @RefineAs(ActivityOptions.class)
8 | public class ActivityOptionsHidden {
9 | public ActivityOptions setCallerDisplayId(int callerDisplayId) {
10 | throw new RuntimeException("Stub!");
11 | }
12 |
13 | public Bundle toBundle() {
14 | throw new RuntimeException("Stub!");
15 | }
16 |
17 | }
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/app/ActivityThread.java:
--------------------------------------------------------------------------------
1 | package android.app;
2 |
3 | public class ActivityThread {
4 | public static ActivityThread currentActivityThread() {
5 | throw new RuntimeException("Stub!");
6 | }
7 |
8 | public Application getApplication() {
9 | throw new RuntimeException("Stub!");
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/app/IActivityManager.java:
--------------------------------------------------------------------------------
1 | package android.app;
2 |
3 | import android.content.IIntentReceiver;
4 | import android.content.IIntentSender;
5 | import android.content.Intent;
6 | import android.os.Binder;
7 | import android.os.Bundle;
8 | import android.os.IBinder;
9 | import android.os.IInterface;
10 |
11 | /**
12 | * Only For Android 8.1-Android 9
13 | */
14 | public interface IActivityManager extends IInterface {
15 | void registerTaskStackListener(ITaskStackListener listener) throws RuntimeException;
16 | void unregisterTaskStackListener(ITaskStackListener listener) throws RuntimeException;
17 | boolean removeTask(int taskId) throws RuntimeException;
18 | void moveStackToDisplay(int stackId, int displayId) throws RuntimeException;
19 |
20 | int sendIntentSender(IIntentSender target, IBinder whitelistToken, int code,
21 | Intent intent, String resolvedType, IIntentReceiver finishedReceiver,
22 | String requiredPermission, Bundle options);
23 |
24 | abstract class Stub extends Binder implements IActivityManager {
25 | public static IActivityManager asInterface(IBinder binder) {
26 | throw new RuntimeException("Stub!");
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/app/IActivityTaskManager.java:
--------------------------------------------------------------------------------
1 | package android.app;
2 |
3 | import android.os.Binder;
4 | import android.os.IBinder;
5 | import android.os.IInterface;
6 |
7 | public interface IActivityTaskManager extends IInterface {
8 | void registerTaskStackListener(ITaskStackListener listener) throws RuntimeException;
9 | void unregisterTaskStackListener(ITaskStackListener listener) throws RuntimeException;
10 | boolean removeTask(int taskId);
11 | //For A11-A13
12 | void moveRootTaskToDisplay(int taskId, int displayId) throws RuntimeException;
13 | //Only for A10
14 | void moveStackToDisplay(int stackId, int displayId) throws RuntimeException;
15 |
16 | abstract class Stub extends Binder implements IActivityTaskManager {
17 | public static IActivityTaskManager asInterface(IBinder binder) {
18 | throw new RuntimeException("Stub!");
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/app/IAppTask.java:
--------------------------------------------------------------------------------
1 | package android.app;
2 |
3 | import android.os.IInterface;
4 |
5 | public interface IAppTask extends IInterface {
6 | }
7 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/app/INotificationManager.java:
--------------------------------------------------------------------------------
1 | package android.app;
2 |
3 | import android.content.ComponentName;
4 | import android.os.Binder;
5 | import android.os.IBinder;
6 | import android.os.IInterface;
7 | import android.service.notification.INotificationListener;
8 |
9 | public interface INotificationManager extends IInterface {
10 | void registerListener(INotificationListener listener, ComponentName component, int userid);
11 | void unregisterListener(INotificationListener listener, int userid);
12 | void cancelNotificationWithTag(String pkg, String opPkg, String tag, int id, int userId);
13 | void cancelNotificationsFromListener(INotificationListener token, String[] keys);
14 | abstract class Stub extends Binder implements INotificationManager {
15 | public static INotificationManager asInterface(IBinder binder) {
16 | throw new RuntimeException("Stub!");
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/app/PendingIntentHidden.java:
--------------------------------------------------------------------------------
1 | package android.app;
2 |
3 | import android.content.IIntentSender;
4 | import android.os.IBinder;
5 |
6 | import dev.rikka.tools.refine.RefineAs;
7 |
8 | @RefineAs(PendingIntent.class)
9 | public class PendingIntentHidden {
10 | public IIntentSender getTarget() {
11 | throw new RuntimeException("Stub!");
12 | }
13 |
14 | public IBinder getWhitelistToken() {
15 | throw new RuntimeException("Stub!");
16 | }
17 |
18 | }
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/content/IIntentReceiver.java:
--------------------------------------------------------------------------------
1 | package android.content;
2 |
3 | import android.os.IInterface;
4 |
5 | public interface IIntentReceiver extends IInterface {
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/content/IIntentSender.java:
--------------------------------------------------------------------------------
1 | package android.content;
2 |
3 | import android.os.IInterface;
4 |
5 | public interface IIntentSender extends IInterface {
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/os/Parcel.java:
--------------------------------------------------------------------------------
1 | package android.os;
2 |
3 | public class Parcel {
4 | }
5 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/os/Parcelable.java:
--------------------------------------------------------------------------------
1 | package android.os;
2 |
3 | public interface Parcelable {
4 | interface Creator{
5 | public T createFromParcel(Parcel source);
6 | public T[] newArray(int size);
7 | }
8 | void writeToParcel(Parcel dest, int flags);
9 | int describeContents();
10 | }
11 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/os/SELinux.java:
--------------------------------------------------------------------------------
1 | package android.os;
2 |
3 | public class SELinux {
4 | public static boolean checkSELinuxAccess(String scon, String tcon, String tclass, String perm) {
5 | throw new UnsupportedOperationException("Stub");
6 | }
7 |
8 | public static boolean setFileContext(String path, String context) {
9 | throw new UnsupportedOperationException("Stub");
10 | }
11 |
12 | public static boolean setFSCreateContext(String context){
13 | throw new UnsupportedOperationException("Stub");
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/os/ServiceManager.java:
--------------------------------------------------------------------------------
1 | package android.os;
2 |
3 | import java.util.Map;
4 |
5 | public class ServiceManager {
6 |
7 | /**
8 | * Returns a reference to a service with the given name.
9 | *
10 | * @param name the name of the service to get
11 | * @return a reference to the service, or null
if the service doesn't exist
12 | */
13 | public static IBinder getService(String name) {
14 | throw new RuntimeException("Stub!");
15 | }
16 |
17 | /**
18 | * Place a new @a service called @a name into the service
19 | * manager.
20 | *
21 | * @param name the name of the new service
22 | * @param service the service object
23 | */
24 | public static void addService(String name, IBinder service) {
25 | throw new RuntimeException("Stub!");
26 | }
27 |
28 | /**
29 | * This is only intended to be called when the process is first being brought
30 | * up and bound by the activity manager. There is only one thread in the process
31 | * at that time, so no locking is done.
32 | *
33 | * @param cache the cache of service references
34 | * @hide
35 | */
36 | public static void initServiceCache(Map cache) {
37 | throw new RuntimeException("Stub!");
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/os/UserHandleHidden.java:
--------------------------------------------------------------------------------
1 | package android.os;
2 |
3 | import dev.rikka.tools.refine.RefineAs;
4 |
5 | @RefineAs(UserHandle.class)
6 | public class UserHandleHidden {
7 |
8 | public UserHandleHidden(int userId) {
9 | throw new RuntimeException("Stub!");
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/service/notification/INotificationListener.java:
--------------------------------------------------------------------------------
1 | package android.service.notification;
2 |
3 | import android.app.Notification;
4 | import android.app.NotificationChannel;
5 | import android.app.NotificationChannelGroup;
6 | import android.os.Binder;
7 | import android.os.Bundle;
8 | import android.os.IBinder;
9 | import android.os.IInterface;
10 | import android.os.UserHandle;
11 |
12 | import java.util.List;
13 |
14 | public interface INotificationListener extends IInterface {
15 | // listeners and assistant
16 | void onListenerConnected(NotificationRankingUpdate update);
17 | void onNotificationPosted(IStatusBarNotificationHolder notificationHolder,
18 | NotificationRankingUpdate update);
19 | void onStatusBarIconsBehaviorChanged(boolean hideSilentStatusIcons);
20 | // stats only for assistant
21 | void onNotificationRemoved(IStatusBarNotificationHolder notificationHolder,
22 | NotificationRankingUpdate update, NotificationStats stats, int reason);
23 | void onNotificationRankingUpdate(NotificationRankingUpdate update);
24 | void onListenerHintsChanged(int hints);
25 | void onInterruptionFilterChanged(int interruptionFilter);
26 |
27 | // companion device managers and assistants only
28 | void onNotificationChannelModification(String pkgName, UserHandle user, NotificationChannel channel, int modificationType);
29 | void onNotificationChannelGroupModification(String pkgName, UserHandle user, NotificationChannelGroup group, int modificationType);
30 |
31 | // assistants only
32 | void onNotificationEnqueuedWithChannel(IStatusBarNotificationHolder notificationHolder, NotificationChannel channel, NotificationRankingUpdate update);
33 | void onNotificationSnoozedUntilContext(IStatusBarNotificationHolder notificationHolder, String snoozeCriterionId);
34 | void onNotificationsSeen(List keys);
35 | void onPanelRevealed(int items);
36 | void onPanelHidden();
37 | void onNotificationVisibilityChanged(String key, boolean isVisible);
38 | void onNotificationExpansionChanged(String key, boolean userAction, boolean expanded);
39 | void onNotificationDirectReply(String key);
40 | void onSuggestedReplySent(String key, CharSequence reply, int source);
41 | void onActionClicked(String key, Notification.Action action, int source);
42 | void onNotificationClicked(String key);
43 | void onAllowedAdjustmentsChanged();
44 | void onNotificationFeedbackReceived(String key, NotificationRankingUpdate update, Bundle feedback);
45 |
46 | abstract class Stub extends Binder implements INotificationListener {
47 | @Override
48 | public IBinder asBinder() {
49 | throw new RuntimeException("Stub!");
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/service/notification/IStatusBarNotificationHolder.java:
--------------------------------------------------------------------------------
1 | package android.service.notification;
2 |
3 | import android.os.IInterface;
4 |
5 | public interface IStatusBarNotificationHolder extends IInterface {
6 | /** Fetch the held StatusBarNotification. This method should only be called once per Holder */
7 | StatusBarNotification get();
8 | }
9 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/service/notification/NotificationRankingUpdate.java:
--------------------------------------------------------------------------------
1 | package android.service.notification;
2 |
3 | public class NotificationRankingUpdate {
4 | }
5 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/service/notification/NotificationStats.java:
--------------------------------------------------------------------------------
1 | package android.service.notification;
2 |
3 | public class NotificationStats {
4 | }
5 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/view/DisplayHidden.java:
--------------------------------------------------------------------------------
1 | package android.view;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import dev.rikka.tools.refine.RefineAs;
7 |
8 | @RefineAs(Display.class)
9 | public class DisplayHidden {
10 | public static final int TYPE_OVERLAY = 4;
11 |
12 | public static final int STATE_ON = 2;
13 |
14 | public static final class Mode implements Parcelable {
15 | public static final Mode[] EMPTY_ARRAY = new Mode[0];
16 | private Mode(Parcel in) {
17 |
18 | }
19 |
20 | public static final Creator CREATOR = new Creator() {
21 | @Override
22 | public Mode createFromParcel(Parcel in) {
23 | return new Mode(in);
24 | }
25 |
26 | @Override
27 | public Mode[] newArray(int size) {
28 | return new Mode[size];
29 | }
30 | };
31 |
32 | @Override
33 | public void writeToParcel(Parcel dest, int flags) {
34 |
35 | }
36 |
37 | @Override
38 | public int describeContents() {
39 | return 0;
40 | }
41 |
42 | public int getPhysicalWidth() {
43 | throw new RuntimeException("Stub!");
44 | }
45 |
46 | public int getPhysicalHeight() {
47 | throw new RuntimeException("Stub!");
48 | }
49 |
50 | public int getModeId() {
51 | throw new RuntimeException("Stub!");
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/view/DisplayShapeHidden.java:
--------------------------------------------------------------------------------
1 | package android.view;
2 |
3 | import dev.rikka.tools.refine.RefineAs;
4 |
5 | @RefineAs(DisplayShape.class)
6 | public class DisplayShapeHidden {
7 |
8 | public static DisplayShape createDefaultDisplayShape(
9 | int displayWidth, int displayHeight, boolean isScreenRound) {
10 | throw new RuntimeException("Stub!");
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/view/IRotationWatcher.java:
--------------------------------------------------------------------------------
1 | package android.view;
2 |
3 | import android.os.Binder;
4 | import android.os.IBinder;
5 | import android.os.IInterface;
6 |
7 | public interface IRotationWatcher extends IInterface {
8 | void onRotationChanged(int rotation) throws RuntimeException;
9 |
10 | abstract class Stub extends Binder implements IRotationWatcher{
11 | @Override
12 | public IBinder asBinder() {
13 | throw new RuntimeException("Stub!");
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/view/IWindowManager.java:
--------------------------------------------------------------------------------
1 | package android.view;
2 |
3 | import android.os.Binder;
4 | import android.os.IBinder;
5 | import android.os.IInterface;
6 |
7 | public interface IWindowManager extends IInterface {
8 | int watchRotation(IRotationWatcher watcher, int displayId);
9 |
10 | void removeRotationWatcher(IRotationWatcher watcher);
11 |
12 | //Only support A12+
13 | void setDisplayImePolicy(int displayId, int imePolicy);
14 |
15 | void freezeDisplayRotation(int displayId, int rotation);
16 |
17 | abstract class Stub extends Binder implements IWindowManager {
18 | public static IWindowManager asInterface(IBinder binder) {
19 | throw new RuntimeException("Stub!");
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/view/SurfaceControlHidden.java:
--------------------------------------------------------------------------------
1 | package android.view;
2 |
3 | import android.os.IBinder;
4 |
5 | import dev.rikka.tools.refine.RefineAs;
6 |
7 | @RefineAs(SurfaceControl.class)
8 | public final class SurfaceControlHidden {
9 |
10 | public static IBinder createDisplay(String name, boolean secure) {
11 | throw new RuntimeException("Stub!");
12 | }
13 | public static void destroyDisplay(IBinder displayToken) {
14 | throw new RuntimeException("Stub!");
15 | }
16 | public static class Transaction {
17 | public static void setDisplaySize(IBinder displayToken, int width, int height) {
18 | throw new RuntimeException("Stub!");
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/view/WindowInsetsHidden.java:
--------------------------------------------------------------------------------
1 | package android.view;
2 |
3 | public class WindowInsetsHidden {
4 | public static final class Type {
5 | static final int FIRST = 1 << 0;
6 | public static final int STATUS_BARS = FIRST;
7 | public static final int NAVIGATION_BARS = 1 << 1;
8 | public static final int CAPTION_BAR = 1 << 2;
9 |
10 | static final int IME = 1 << 3;
11 |
12 | static final int SYSTEM_GESTURES = 1 << 4;
13 | static final int MANDATORY_SYSTEM_GESTURES = 1 << 5;
14 | static final int TAPPABLE_ELEMENT = 1 << 6;
15 |
16 | static final int DISPLAY_CUTOUT = 1 << 7;
17 |
18 | static final int WINDOW_DECOR = 1 << 8;
19 |
20 | static final int GENERIC_OVERLAYS = 1 << 9;
21 | static final int LAST = GENERIC_OVERLAYS;
22 | static final int SIZE = 10;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/view/WindowManagerHidden.java:
--------------------------------------------------------------------------------
1 | package android.view;
2 |
3 | import dev.rikka.tools.refine.RefineAs;
4 |
5 | @RefineAs(WindowManager.class)
6 | public interface WindowManagerHidden{
7 | public static class LayoutParams extends ViewGroup.LayoutParams{
8 | /**
9 | * Flag to indicate that the window is controlling how it fits window insets on its own.
10 | * So we don't need to adjust its attributes for fitting window insets.
11 | */
12 | public static final int PRIVATE_FLAG_FIT_INSETS_CONTROLLED = 0x10000000;
13 |
14 | /**
15 | * Flag to request creation of a BLAST (Buffer as LayerState) Layer.
16 | * If not specified the client will receive a BufferQueue layer.
17 | */
18 | public static final int PRIVATE_FLAG_USE_BLAST = 0x02000000;
19 |
20 | /** In a multiuser system if this flag is set and the owner is a system process then this
21 | * window will appear on all user screens. This overrides the default behavior of window
22 | * types that normally only appear on the owning user's screen. Refer to each window type
23 | * to determine its default behavior.
24 | */
25 | public static final int SYSTEM_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
26 |
27 | /**
28 | * Indicates that this window is the rounded corners overlay present on some
29 | * devices this means that it will be excluded from: screenshots,
30 | * screen magnification, and mirroring.
31 | */
32 | public static final int PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY = 0x00100000;
33 |
34 | /**
35 | * Flag to indicate that the window is a trusted overlay.
36 | */
37 | public static final int PRIVATE_FLAG_TRUSTED_OVERLAY = 0x20000000;
38 |
39 | private int mFitInsetsTypes;
40 |
41 | public int x;
42 | public int y;
43 | public int type;
44 | public int width;
45 | public int height;
46 | public int flags;
47 | public int format;
48 | public int privateFlags;
49 |
50 | public LayoutParams() {
51 | super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
52 | throw new RuntimeException("Stub!");
53 | }
54 |
55 | public void setFitInsetsTypes(int types) {
56 | throw new RuntimeException("Stub!");
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/view/WindowManagerPolicyConstants.java:
--------------------------------------------------------------------------------
1 | package android.view;
2 |
3 | public interface WindowManagerPolicyConstants {
4 | interface PointerEventListener {
5 | /**
6 | * 1. onPointerEvent will be called on the service.UiThread.
7 | * 2. motionEvent will be recycled after onPointerEvent returns so if it is needed later a
8 | * copy() must be made and the copy must be recycled.
9 | **/
10 | void onPointerEvent(MotionEvent motionEvent);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/android/window/TaskSnapshot.java:
--------------------------------------------------------------------------------
1 | package android.window;
2 |
3 | public class TaskSnapshot {
4 | }
5 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/com/android/internal/content/ReferrerIntent.java:
--------------------------------------------------------------------------------
1 | package com.android.internal.content;
2 |
3 | import android.content.Intent;
4 |
5 | public class ReferrerIntent extends Intent {
6 | }
7 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/com/android/internal/statusbar/IStatusBarService.java:
--------------------------------------------------------------------------------
1 | package com.android.internal.statusbar;
2 |
3 | import android.os.Binder;
4 | import android.os.IBinder;
5 | import android.os.IInterface;
6 |
7 | public interface IStatusBarService extends IInterface {
8 | void collapsePanels();
9 |
10 | abstract class Stub extends Binder implements IStatusBarService {
11 | public static IStatusBarService asInterface(IBinder binder) {
12 | throw new RuntimeException("Stub!");
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/com/android/server/SystemServer.java:
--------------------------------------------------------------------------------
1 | package com.android.server;
2 |
3 | public class SystemServer {
4 | }
5 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/com/android/server/SystemService.java:
--------------------------------------------------------------------------------
1 | package com.android.server;
2 |
3 | public abstract class SystemService {
4 | }
5 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/com/android/server/display/DisplayAdapter.java:
--------------------------------------------------------------------------------
1 | package com.android.server.display;
2 |
3 | import android.content.Context;
4 | import android.os.Handler;
5 | import android.view.DisplayHidden;
6 |
7 | import java.io.PrintWriter;
8 |
9 | abstract class DisplayAdapter {
10 |
11 | public static final int DISPLAY_DEVICE_EVENT_ADDED = 1;
12 | public static final int DISPLAY_DEVICE_EVENT_CHANGED = 2;
13 | public static final int DISPLAY_DEVICE_EVENT_REMOVED = 3;
14 |
15 | public DisplayAdapter(DisplayManagerService.SyncRoot syncRoot,
16 | Context context, Handler handler, Listener listener, String name) {
17 | throw new RuntimeException("Stub!");
18 | }
19 |
20 | public static DisplayHidden.Mode createMode(int width, int height, float refreshRate) {
21 | throw new RuntimeException("Stub!");
22 | }
23 |
24 | public static DisplayHidden.Mode createMode(int width, int height, float refreshRate,
25 | float[] alternativeRefreshRates) {
26 | throw new RuntimeException("Stub!");
27 | }
28 |
29 | public void dumpLocked(PrintWriter pw) {
30 | throw new RuntimeException("Stub!");
31 | }
32 |
33 | public final Context getContext() {
34 | throw new RuntimeException("Stub!");
35 | }
36 |
37 | public final Handler getHandler() {
38 | throw new RuntimeException("Stub!");
39 | }
40 |
41 | public final String getName() {
42 | throw new RuntimeException("Stub!");
43 | }
44 |
45 | public final DisplayManagerService.SyncRoot getSyncRoot() {
46 | throw new RuntimeException("Stub!");
47 | }
48 |
49 | public void registerLocked() {
50 | throw new RuntimeException("Stub!");
51 | }
52 |
53 | public final void sendDisplayDeviceEventLocked(final DisplayDevice device, final int event) {
54 | throw new RuntimeException("Stub!");
55 | }
56 |
57 | public final void sendTraversalRequestLocked() {
58 | throw new RuntimeException("Stub!");
59 | }
60 |
61 | public interface Listener {
62 | void onDisplayDeviceEvent(DisplayDevice device, int event);
63 |
64 | void onTraversalRequested();
65 | }
66 | }
67 |
68 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/com/android/server/display/DisplayControl.java:
--------------------------------------------------------------------------------
1 | package com.android.server.display;
2 |
3 | import android.os.IBinder;
4 |
5 | public class DisplayControl {
6 |
7 | /**
8 | * Create a display in SurfaceFlinger.
9 | *
10 | * @param name The name of the display
11 | * @param secure Whether this display is secure.
12 | * @return The token reference for the display in SurfaceFlinger.
13 | */
14 | public static IBinder createDisplay(String name, boolean secure) {
15 | throw new RuntimeException("Stub!");
16 | }
17 |
18 | /**
19 | * Create a display in SurfaceFlinger.
20 | *
21 | * @param name The name of the display
22 | * @param secure Whether this display is secure.
23 | * @param requestedRefreshRate The requested refresh rate in frames per second.
24 | * For best results, specify a divisor of the physical refresh rate, e.g., 30 or 60 on
25 | * 120hz display. If an arbitrary refresh rate is specified, the rate will be rounded
26 | * up or down to a divisor of the physical display. If 0 is specified, the virtual
27 | * display is refreshed at the physical display refresh rate.
28 | * @return The token reference for the display in SurfaceFlinger.
29 | */
30 | public static IBinder createDisplay(String name, boolean secure,
31 | float requestedRefreshRate) {
32 | throw new RuntimeException("Stub!");
33 | }
34 |
35 | /**
36 | * Destroy a display in SurfaceFlinger.
37 | *
38 | * @param displayToken The display token for the display to be destroyed.
39 | */
40 | public static void destroyDisplay(IBinder displayToken) {
41 | throw new RuntimeException("Stub!");
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/com/android/server/display/DisplayDevice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.server.display;
18 |
19 | import android.content.Context;
20 | import android.os.IBinder;
21 | import android.view.Surface;
22 | import android.view.SurfaceControlHidden;
23 |
24 | /**
25 | * Represents a physical display device such as the built-in display
26 | * an external monitor, or a WiFi display.
27 | *
28 | * Display devices are guarded by the {@link DisplayManagerService.SyncRoot} lock.
29 | *
30 | */
31 | abstract class DisplayDevice {
32 |
33 | public DisplayDevice(DisplayAdapter displayAdapter, IBinder displayToken, String uniqueId,
34 | Context context) {
35 | throw new RuntimeException("Stub!");
36 | }
37 |
38 | public DisplayDevice(DisplayAdapter displayAdapter, IBinder displayToken, String uniqueId) {
39 | throw new RuntimeException("Stub!");
40 | }
41 |
42 | /**
43 | * Gets the Surface Flinger display token for this display.
44 | *
45 | * @return The display token, or null if the display is not being managed
46 | * by Surface Flinger.
47 | */
48 | public final IBinder getDisplayTokenLocked() {
49 | throw new RuntimeException("Stub!");
50 | }
51 |
52 | /**
53 | * Returns the unique id of the display device.
54 | */
55 | public final String getUniqueId() {
56 | throw new RuntimeException("Stub!");
57 | }
58 |
59 | /**
60 | * Returns whether the unique id of the device is stable across reboots.
61 | */
62 | public abstract boolean hasStableUniqueId();
63 |
64 | /**
65 | * Gets information about the display device.
66 | *
67 | * The information returned should not change between calls unless the display
68 | * adapter sent a {@link DisplayAdapter#DISPLAY_DEVICE_EVENT_CHANGED} event and
69 | * {@link #applyPendingDisplayDeviceInfoChangesLocked()} has been called to apply
70 | * the pending changes.
71 | *
72 | * @return The display device info, which should be treated as immutable by the caller.
73 | * The display device should allocate a new display device info object whenever
74 | * the data changes.
75 | */
76 | public abstract DisplayDeviceInfo getDisplayDeviceInfoLocked();
77 |
78 | /**
79 | * Gives the display device a chance to update its properties while in a transaction.
80 | */
81 | public void performTraversalLocked(SurfaceControlHidden.Transaction t) {
82 | throw new RuntimeException("Stub!");
83 | }
84 |
85 | /**
86 | * Sets the display surface while in a transaction.
87 | */
88 | public final void setSurfaceLocked(SurfaceControlHidden.Transaction t, Surface surface) {
89 | throw new RuntimeException("Stub!");
90 | }
91 | }
--------------------------------------------------------------------------------
/hidden-api/src/main/java/com/android/server/display/DisplayDeviceInfo.java:
--------------------------------------------------------------------------------
1 | package com.android.server.display;
2 |
3 | import android.view.DisplayHidden;
4 | import android.view.DisplayShape;
5 |
6 | final class DisplayDeviceInfo {
7 | /**
8 | * Flag: Indicates that this display device has secure video output, such as HDCP.
9 | */
10 | public static final int FLAG_SECURE = 1 << 2;
11 |
12 | /**
13 | * Flag: Indicates that the display is suitable for presentations.
14 | */
15 | public static final int FLAG_PRESENTATION = 1 << 6;
16 |
17 | /**
18 | * Flag: Only show this display's own content; do not mirror
19 | * the content of another display.
20 | */
21 | public static final int FLAG_OWN_CONTENT_ONLY = 1 << 7;
22 |
23 | /**
24 | * Flag: This flag identifies secondary displays that should show system decorations, such as
25 | * status bar, navigation bar, home activity or IME.
26 | * Note that this flag doesn't work without {@link #FLAG_TRUSTED}
27 | * @hide
28 | */
29 | // TODO (b/114338689): Remove the flag and use IWindowManager#setShouldShowSystemDecors
30 | public static final int FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS = 1 << 12;
31 |
32 | /**
33 | * Flag: The display is trusted to show system decorations and receive inputs without users'
34 | * touch.
35 | * @see #FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS
36 | */
37 | public static final int FLAG_TRUSTED = 1 << 13;
38 |
39 | /**
40 | * Touch attachment: Touch input is via the internal interface.
41 | */
42 | public static final int TOUCH_INTERNAL = 1;
43 |
44 | /**
45 | * Touch attachment: Touch input is via an input device matching {@link VirtualDisplay}'s
46 | * uniqueId.
47 | * @hide
48 | */
49 | public static final int TOUCH_VIRTUAL = 3;
50 |
51 | /**
52 | * Gets the name of the display device, which may be derived from EDID or
53 | * other sources. The name may be localized and displayed to the user.
54 | */
55 | public String name;
56 |
57 | /**
58 | * Unique Id of display device.
59 | */
60 | public String uniqueId;
61 |
62 | /**
63 | * The width of the display in its natural orientation, in pixels.
64 | * This value is not affected by display rotation.
65 | */
66 | public int width;
67 |
68 | /**
69 | * The height of the display in its natural orientation, in pixels.
70 | * This value is not affected by display rotation.
71 | */
72 | public int height;
73 |
74 | /**
75 | * The active mode of the display.
76 | */
77 | public int modeId;
78 |
79 | /**
80 | * The default mode of the display.
81 | */
82 | public int defaultModeId;
83 |
84 | /**
85 | * The supported modes of the display.
86 | */
87 | public DisplayHidden.Mode[] supportedModes = DisplayHidden.Mode.EMPTY_ARRAY;
88 |
89 |
90 | /**
91 | * The nominal apparent density of the display in DPI used for layout calculations.
92 | * This density is sensitive to the viewing distance. A big TV and a tablet may have
93 | * the same apparent density even though the pixels on the TV are much bigger than
94 | * those on the tablet.
95 | */
96 | public int densityDpi;
97 |
98 | /**
99 | * The physical density of the display in DPI in the X direction.
100 | * This density should specify the physical size of each pixel.
101 | */
102 | public float xDpi;
103 |
104 | /**
105 | * The physical density of the display in DPI in the X direction.
106 | * This density should specify the physical size of each pixel.
107 | */
108 | public float yDpi;
109 |
110 | /**
111 | * This is how far in advance a buffer must be queued for presentation at
112 | * a given time. If you want a buffer to appear on the screen at
113 | * time N, you must submit the buffer before (N - bufferDeadlineNanos).
114 | */
115 | public long presentationDeadlineNanos;
116 |
117 | /**
118 | * Display flags.
119 | */
120 | public int flags;
121 |
122 | /**
123 | * The {@link RoundedCorners} if present or {@code null} otherwise.
124 | */
125 | public DisplayShape displayShape;
126 |
127 | /**
128 | * The touch attachment, per {@link DisplayViewport#touch}.
129 | */
130 | public int touch;
131 |
132 | /**
133 | * Display type.
134 | */
135 | public int type;
136 |
137 | /**
138 | * Display state.
139 | */
140 | public int state = DisplayHidden.STATE_ON;
141 | }
142 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/com/android/server/display/DisplayDeviceRepository.java:
--------------------------------------------------------------------------------
1 | package com.android.server.display;
2 |
3 | class DisplayDeviceRepository implements DisplayAdapter.Listener{
4 | public void addListener(Listener listener) {
5 | throw new RuntimeException("Stub!");
6 | }
7 |
8 | @Override
9 | public void onDisplayDeviceEvent(DisplayDevice device, int event) {
10 | throw new RuntimeException("Stub!");
11 | }
12 |
13 | @Override
14 | public void onTraversalRequested() {
15 | throw new RuntimeException("Stub!");
16 | }
17 |
18 | /**
19 | * Listens to {@link DisplayDevice} events from {@link DisplayDeviceRepository}.
20 | */
21 | public interface Listener {
22 | void onDisplayDeviceEventLocked(DisplayDevice device, int event);
23 |
24 | // TODO: multi-display - Try to remove the need for requestTraversal...it feels like
25 | // a shoe-horned method for a shoe-horned feature.
26 | void onTraversalRequested();
27 | };
28 | }
29 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/com/android/server/display/DisplayManagerService.java:
--------------------------------------------------------------------------------
1 | package com.android.server.display;
2 |
3 | import android.content.Context;
4 | import android.os.Handler;
5 |
6 | import com.android.server.SystemService;
7 |
8 | public final class DisplayManagerService extends SystemService {
9 |
10 | private final SyncRoot mSyncRoot = null;
11 | private final Context mContext = null;
12 | private final DisplayManagerHandler mHandler = null;
13 | private final DisplayDeviceRepository mDisplayDeviceRepo = null;
14 | private final Handler mUiHandler = null;
15 |
16 | public static final class SyncRoot {
17 | public SyncRoot() { }
18 | }
19 |
20 | private final class DisplayManagerHandler {
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/com/android/server/display/DisplayModeDirector.java:
--------------------------------------------------------------------------------
1 | package com.android.server.display;
2 |
3 | public class DisplayModeDirector {
4 | public static final class DesiredDisplayModeSpecs {
5 | public int baseModeId;
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/com/android/server/display/LogicalDisplay.java:
--------------------------------------------------------------------------------
1 | package com.android.server.display;
2 |
3 | final class LogicalDisplay {
4 | /**
5 | * Gets the logical display id of this logical display.
6 | *
7 | * @return The logical display id.
8 | */
9 | public int getDisplayIdLocked() {
10 | throw new RuntimeException("Stub!");
11 | }
12 |
13 | public DisplayDevice getPrimaryDisplayDeviceLocked() {
14 | throw new RuntimeException("Stub!");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/com/android/server/display/LogicalDisplayMapper.java:
--------------------------------------------------------------------------------
1 | package com.android.server.display;
2 |
3 | class LogicalDisplayMapper {
4 | public LogicalDisplay getDisplayLocked(DisplayDevice device) {
5 | throw new RuntimeException("Stub!");
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/com/android/server/input/InputManagerService.java:
--------------------------------------------------------------------------------
1 | package com.android.server.input;
2 |
3 | import android.view.InputEvent;
4 |
5 | public class InputManagerService {
6 | public boolean injectInputEvent(InputEvent event, int mode) {
7 | throw new RuntimeException("Stub!");
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/hidden-api/src/main/java/com/android/server/wm/WindowManagerService.java:
--------------------------------------------------------------------------------
1 | package com.android.server.wm;
2 |
3 | public class WindowManagerService {
4 | }
5 |
--------------------------------------------------------------------------------
/hidden-api/src/test/java/io/sunshine0523/hidden/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package io.sunshine0523.hidden
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/service/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/service/build.gradle.kts:
--------------------------------------------------------------------------------
1 | @Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
2 | plugins {
3 | alias(libs.plugins.androidLibrary)
4 | }
5 |
6 | android {
7 | namespace = "com.sunshine.freeform"
8 |
9 | buildFeatures {
10 | aidl = true
11 | }
12 |
13 | buildTypes {
14 | release {
15 | isMinifyEnabled = false
16 | proguardFiles(
17 | getDefaultProguardFile("proguard-android-optimize.txt"),
18 | "proguard-rules.pro"
19 | )
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/service/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine0523/Mi-Freeform/0a078b385fbd12d4bfd83dbe905e8eaa62ac36c1/service/consumer-rules.pro
--------------------------------------------------------------------------------
/service/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
23 | -keep class * implements android.os.IInterface {*;}
--------------------------------------------------------------------------------
/service/src/androidTest/java/io/sunshine0523/freeform/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.sunshine.freeform
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("io.sunshine0523.service.test", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/service/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/service/src/main/aidl/io/sunshine0523/freeform/IMiFreeformDisplayCallback.aidl:
--------------------------------------------------------------------------------
1 | // IMiFreeformDisplayCallback.aidl
2 | package io.sunshine0523.freeform;
3 |
4 | oneway interface IMiFreeformDisplayCallback {
5 | void onDisplayPaused();
6 | void onDisplayResumed();
7 | void onDisplayStopped();
8 | void onDisplayAdd(int displayId);
9 | }
--------------------------------------------------------------------------------
/service/src/main/aidl/io/sunshine0523/freeform/IMiFreeformUIService.aidl:
--------------------------------------------------------------------------------
1 | package io.sunshine0523.freeform;
2 |
3 | import android.content.ComponentName;
4 | import android.view.InputEvent;
5 | import android.view.Surface;
6 | import android.os.IBinder;
7 | import io.sunshine0523.freeform.IMiFreeformDisplayCallback;
8 |
9 | interface IMiFreeformUIService {
10 | // start freeform in system
11 | void startAppInFreeform(String packageName, String activityName, int userId, in PendingIntent pendingIntent,
12 | int width, int height, int densityDpi, float refreshRate,
13 | boolean secure, boolean ownContentOnly, boolean shouldShowSystemDecorations,
14 | String resPkg, String layoutName) = 0;
15 | // remove freeform by freeformId: packageName,activityName,userId
16 | void removeFreeform(String freeformId) = 1;
17 | // create freeform in user
18 | void createFreeformInUser(String name, int width, int height, int densityDpi, float refreshRate,
19 | boolean secure, boolean ownContentOnly, boolean shouldShowSystemDecorations,
20 | in Surface surface, IMiFreeformDisplayCallback callback) = 2;
21 | void resizeFreeform(IBinder appToken, int width, int height, int densityDpi) = 3;
22 | void releaseFreeform(IBinder appToken) = 4;
23 | boolean ping() = 5;
24 | String getSettings() = 6;
25 | void setSettings(String settings) = 7;
26 | String getLog() = 8;
27 | void clearLog() = 9;
28 | void collapseStatusBar() = 10;
29 | void cancelNotification(String key) = 11;
30 | }
--------------------------------------------------------------------------------
/service/src/test/java/io/sunshine0523/freeform/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.sunshine.freeform
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | //enable projects.x for implementation
2 | enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
3 |
4 | pluginManagement {
5 | repositories {
6 | gradlePluginPortal()
7 | google()
8 | mavenCentral()
9 | maven(url = "https://maven.kr328.app/releases")
10 | }
11 | }
12 | dependencyResolutionManagement {
13 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
14 | repositories {
15 | google()
16 | mavenCentral()
17 | maven(url = "https://maven.kr328.app/releases")
18 | }
19 | }
20 |
21 | rootProject.name = "Mi-Freeform"
22 | include(
23 | ":app",
24 | ":hidden-api",
25 | ":freeform-server",
26 | ":service"
27 | )
28 |
--------------------------------------------------------------------------------