|
|
|
@ -11,6 +11,8 @@ public class StatusBarManager {
|
|
|
|
|
|
|
|
|
|
private final IInterface manager;
|
|
|
|
|
private Method expandNotificationsPanelMethod;
|
|
|
|
|
private Method expandSettingsPanelMethod;
|
|
|
|
|
private boolean expandSettingsPanelMethodNewVersion = true;
|
|
|
|
|
private Method collapsePanelsMethod;
|
|
|
|
|
|
|
|
|
|
public StatusBarManager(IInterface manager) {
|
|
|
|
@ -24,6 +26,20 @@ public class StatusBarManager {
|
|
|
|
|
return expandNotificationsPanelMethod;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Method getExpandSettingsPanel() throws NoSuchMethodException {
|
|
|
|
|
if (expandSettingsPanelMethod == null) {
|
|
|
|
|
try {
|
|
|
|
|
// Since Android 7: https://android.googlesource.com/platform/frameworks/base.git/+/a9927325eda025504d59bb6594fee8e240d95b01%5E%21/
|
|
|
|
|
expandSettingsPanelMethod = manager.getClass().getMethod("expandSettingsPanel", String.class);
|
|
|
|
|
} catch (NoSuchMethodException e) {
|
|
|
|
|
// old version
|
|
|
|
|
expandSettingsPanelMethod = manager.getClass().getMethod("expandSettingsPanel");
|
|
|
|
|
expandSettingsPanelMethodNewVersion = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return expandSettingsPanelMethod;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Method getCollapsePanelsMethod() throws NoSuchMethodException {
|
|
|
|
|
if (collapsePanelsMethod == null) {
|
|
|
|
|
collapsePanelsMethod = manager.getClass().getMethod("collapsePanels");
|
|
|
|
@ -40,6 +56,21 @@ public class StatusBarManager {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void expandSettingsPanel() {
|
|
|
|
|
try {
|
|
|
|
|
Method method = getExpandSettingsPanel();
|
|
|
|
|
if (expandSettingsPanelMethodNewVersion) {
|
|
|
|
|
// new version
|
|
|
|
|
method.invoke(manager, (Object) null);
|
|
|
|
|
} else {
|
|
|
|
|
// old version
|
|
|
|
|
method.invoke(manager);
|
|
|
|
|
}
|
|
|
|
|
} catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
|
|
|
|
|
Ln.e("Could not invoke method", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void collapsePanels() {
|
|
|
|
|
try {
|
|
|
|
|
Method method = getCollapsePanelsMethod();
|
|
|
|
|