aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/app/sidephonelauncher/helper/Utils.kt22
1 files changed, 17 insertions, 5 deletions
diff --git a/app/src/main/java/app/sidephonelauncher/helper/Utils.kt b/app/src/main/java/app/sidephonelauncher/helper/Utils.kt
index 281fd59..3c07382 100644
--- a/app/src/main/java/app/sidephonelauncher/helper/Utils.kt
+++ b/app/src/main/java/app/sidephonelauncher/helper/Utils.kt
@@ -471,14 +471,26 @@ fun openSearch(context: Context) {
@SuppressLint("WrongConstant", "PrivateApi")
fun expandNotificationDrawer(context: Context) {
- // Source: https://stackoverflow.com/a/51132142
+ // Kyocera's SystemUI does not implement the standard notification shade.
+ // It uses a custom NotificationActivity instead, so start that explicitly.
+ // On other devices, fall back to the standard StatusBarManager call.
try {
- val statusBarService = context.getSystemService("statusbar")
- val statusBarManager = Class.forName("android.app.StatusBarManager")
- val method = statusBarManager.getMethod("expandNotificationsPanel")
- method.invoke(statusBarService)
+ val intent = Intent("android.intent.action.SHOW_NOTIFICATION_ACTIVITY")
+ intent.setClassName(
+ "com.android.systemui",
+ "com.android.systemui.statusbar.NotificationActivity"
+ )
+ context.startActivity(intent)
} catch (e: Exception) {
e.printStackTrace()
+ try {
+ val statusBarService = context.getSystemService("statusbar")
+ val statusBarManager = Class.forName("android.app.StatusBarManager")
+ val method = statusBarManager.getMethod("expandNotificationsPanel")
+ method.invoke(statusBarService)
+ } catch (e2: Exception) {
+ e2.printStackTrace()
+ }
}
}