mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-03 14:49:29 +00:00
expandSettingsPanel() changed API with android 9
Now it gets a parameter. However, it can be null https://code.yawk.at/android/android-9.0.0_r35/android/app/StatusBarManager.java#android.app.StatusBarManager%23expandSettingsPanel(java.lang.String) For now, I don't have android 10's but it's probably a version without the noargument method
This commit is contained in:
parent
499f595088
commit
cd533a9ab2
1 changed files with 15 additions and 2 deletions
|
@ -12,6 +12,7 @@ public class StatusBarManager {
|
||||||
private final IInterface manager;
|
private final IInterface manager;
|
||||||
private Method expandNotificationsPanelMethod;
|
private Method expandNotificationsPanelMethod;
|
||||||
private Method expandSettingsPanelMethod;
|
private Method expandSettingsPanelMethod;
|
||||||
|
private Object[] expandSettingsPanelArgs;
|
||||||
private Method collapsePanelsMethod;
|
private Method collapsePanelsMethod;
|
||||||
|
|
||||||
public StatusBarManager(IInterface manager) {
|
public StatusBarManager(IInterface manager) {
|
||||||
|
@ -27,7 +28,19 @@ public class StatusBarManager {
|
||||||
|
|
||||||
private Method getExpandSettingsPanel() throws NoSuchMethodException {
|
private Method getExpandSettingsPanel() throws NoSuchMethodException {
|
||||||
if (expandSettingsPanelMethod == null) {
|
if (expandSettingsPanelMethod == null) {
|
||||||
|
try{
|
||||||
expandSettingsPanelMethod = manager.getClass().getMethod("expandSettingsPanel");
|
expandSettingsPanelMethod = manager.getClass().getMethod("expandSettingsPanel");
|
||||||
|
expandSettingsPanelArgs = new Object[] {};
|
||||||
|
} catch (NoSuchMethodException e){
|
||||||
|
try{
|
||||||
|
expandSettingsPanelMethod = manager.getClass().getMethod("expandSettingsPanel", String.class);
|
||||||
|
expandSettingsPanelArgs = new Object[] {null};
|
||||||
|
} catch (NoSuchMethodException f){
|
||||||
|
f.initCause(e);
|
||||||
|
throw f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return expandSettingsPanelMethod;
|
return expandSettingsPanelMethod;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +63,7 @@ public class StatusBarManager {
|
||||||
public void expandSettingsPanel() {
|
public void expandSettingsPanel() {
|
||||||
try {
|
try {
|
||||||
Method method = getExpandSettingsPanel();
|
Method method = getExpandSettingsPanel();
|
||||||
method.invoke(manager);
|
method.invoke(manager, expandSettingsPanelArgs);
|
||||||
} catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
|
} catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
|
||||||
Ln.e("Could not invoke method", e);
|
Ln.e("Could not invoke method", e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue