Skip to content

Display and control your Android device

Rename control message type to COLLAPSE_PANELS

brunoais66c581851fe9
diff --git a/app/src/control_msg.c b/app/src/control_msg.c
index 69e75014..7d18fb6a 100644
--- a/app/src/control_msg.c
+++ b/app/src/control_msg.c
@@ -81,7 +81,7 @@ control_msg_serialize(const struct control_msg *msg, unsigned char *buf) {
buf[1] = msg->set_screen_power_mode.mode;
return 2;
case CONTROL_MSG_TYPE_EXPAND_NOTIFICATION_PANEL:
- case CONTROL_MSG_TYPE_COLLAPSE_NOTIFICATION_PANEL:
+ case CONTROL_MSG_TYPE_COLLAPSE_PANELS:
case CONTROL_MSG_TYPE_GET_CLIPBOARD:
case CONTROL_MSG_TYPE_ROTATE_DEVICE:
// no additional data
diff --git a/app/src/control_msg.h b/app/src/control_msg.h
index 8d9ab7d4..1e9481d9 100644
--- a/app/src/control_msg.h
+++ b/app/src/control_msg.h
@@ -27,7 +27,7 @@ enum control_msg_type {
CONTROL_MSG_TYPE_INJECT_SCROLL_EVENT,
CONTROL_MSG_TYPE_BACK_OR_SCREEN_ON,
CONTROL_MSG_TYPE_EXPAND_NOTIFICATION_PANEL,
- CONTROL_MSG_TYPE_COLLAPSE_NOTIFICATION_PANEL,
+ CONTROL_MSG_TYPE_COLLAPSE_PANELS,
CONTROL_MSG_TYPE_GET_CLIPBOARD,
CONTROL_MSG_TYPE_SET_CLIPBOARD,
CONTROL_MSG_TYPE_SET_SCREEN_POWER_MODE,
diff --git a/app/src/input_manager.c b/app/src/input_manager.c
index b8a8c846..574e02d4 100644
--- a/app/src/input_manager.c
+++ b/app/src/input_manager.c
@@ -179,9 +179,9 @@ expand_notification_panel(struct controller *controller) {
}
static void
-collapse_notification_panel(struct controller *controller) {
+collapse_panels(struct controller *controller) {
struct control_msg msg;
- msg.type = CONTROL_MSG_TYPE_COLLAPSE_NOTIFICATION_PANEL;
+ msg.type = CONTROL_MSG_TYPE_COLLAPSE_PANELS;
if (!controller_push_msg(controller, &msg)) {
LOGW("Could not request 'collapse notification panel'");
@@ -498,7 +498,7 @@ input_manager_process_key(struct input_manager *im,
case SDLK_n:
if (control && !repeat && down) {
if (shift) {
- collapse_notification_panel(controller);
+ collapse_panels(controller);
} else {
expand_notification_panel(controller);
}
diff --git a/app/tests/test_control_msg_serialize.c b/app/tests/test_control_msg_serialize.c
index 4771ce1f..d7b89929 100644
--- a/app/tests/test_control_msg_serialize.c
+++ b/app/tests/test_control_msg_serialize.c
@@ -177,9 +177,9 @@ static void test_serialize_expand_notification_panel(void) {
assert(!memcmp(buf, expected, sizeof(expected)));
}
-static void test_serialize_collapse_notification_panel(void) {
+static void test_serialize_collapse_panels(void) {
struct control_msg msg = {
- .type = CONTROL_MSG_TYPE_COLLAPSE_NOTIFICATION_PANEL,
+ .type = CONTROL_MSG_TYPE_COLLAPSE_PANELS,
};
unsigned char buf[CONTROL_MSG_MAX_SIZE];
@@ -187,7 +187,7 @@ static void test_serialize_collapse_notification_panel(void) {
assert(size == 1);
const unsigned char expected[] = {
- CONTROL_MSG_TYPE_COLLAPSE_NOTIFICATION_PANEL,
+ CONTROL_MSG_TYPE_COLLAPSE_PANELS,
};
assert(!memcmp(buf, expected, sizeof(expected)));
}
@@ -274,7 +274,7 @@ int main(int argc, char *argv[]) {
test_serialize_inject_scroll_event();
test_serialize_back_or_screen_on();
test_serialize_expand_notification_panel();
- test_serialize_collapse_notification_panel();
+ test_serialize_collapse_panels();
test_serialize_get_clipboard();
test_serialize_set_clipboard();
test_serialize_set_screen_power_mode();
diff --git a/server/src/main/java/com/genymobile/scrcpy/ControlMessage.java b/server/src/main/java/com/genymobile/scrcpy/ControlMessage.java
index 44cb1b59..34ce1941 100644
--- a/server/src/main/java/com/genymobile/scrcpy/ControlMessage.java
+++ b/server/src/main/java/com/genymobile/scrcpy/ControlMessage.java
@@ -11,7 +11,7 @@ public final class ControlMessage {
public static final int TYPE_INJECT_SCROLL_EVENT = 3;
public static final int TYPE_BACK_OR_SCREEN_ON = 4;
public static final int TYPE_EXPAND_NOTIFICATION_PANEL = 5;
- public static final int TYPE_COLLAPSE_NOTIFICATION_PANEL = 6;
+ public static final int TYPE_COLLAPSE_PANELS = 6;
public static final int TYPE_GET_CLIPBOARD = 7;
public static final int TYPE_SET_CLIPBOARD = 8;
public static final int TYPE_SET_SCREEN_POWER_MODE = 9;
diff --git a/server/src/main/java/com/genymobile/scrcpy/ControlMessageReader.java b/server/src/main/java/com/genymobile/scrcpy/ControlMessageReader.java
index 7ebecf76..97f027ff 100644
--- a/server/src/main/java/com/genymobile/scrcpy/ControlMessageReader.java
+++ b/server/src/main/java/com/genymobile/scrcpy/ControlMessageReader.java
@@ -77,7 +77,7 @@ public class ControlMessageReader {
msg = parseSetScreenPowerMode();
break;
case ControlMessage.TYPE_EXPAND_NOTIFICATION_PANEL:
- case ControlMessage.TYPE_COLLAPSE_NOTIFICATION_PANEL:
+ case ControlMessage.TYPE_COLLAPSE_PANELS:
case ControlMessage.TYPE_GET_CLIPBOARD:
case ControlMessage.TYPE_ROTATE_DEVICE:
msg = ControlMessage.createEmpty(type);
diff --git a/server/src/main/java/com/genymobile/scrcpy/Controller.java b/server/src/main/java/com/genymobile/scrcpy/Controller.java
index 6af5ddf6..15c0584a 100644
--- a/server/src/main/java/com/genymobile/scrcpy/Controller.java
+++ b/server/src/main/java/com/genymobile/scrcpy/Controller.java
@@ -107,7 +107,7 @@ public class Controller {
case ControlMessage.TYPE_EXPAND_NOTIFICATION_PANEL:
Device.expandNotificationPanel();
break;
- case ControlMessage.TYPE_COLLAPSE_NOTIFICATION_PANEL:
+ case ControlMessage.TYPE_COLLAPSE_PANELS:
Device.collapsePanels();
break;
case ControlMessage.TYPE_GET_CLIPBOARD:
diff --git a/server/src/test/java/com/genymobile/scrcpy/ControlMessageReaderTest.java b/server/src/test/java/com/genymobile/scrcpy/ControlMessageReaderTest.java
index 6167ddeb..97429026 100644
--- a/server/src/test/java/com/genymobile/scrcpy/ControlMessageReaderTest.java
+++ b/server/src/test/java/com/genymobile/scrcpy/ControlMessageReaderTest.java
@@ -182,19 +182,19 @@ public class ControlMessageReaderTest {
}
@Test
- public void testParseCollapseNotificationPanelEvent() throws IOException {
+ public void testParseCollapsePanelsEvent() throws IOException {
ControlMessageReader reader = new ControlMessageReader();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(bos);
- dos.writeByte(ControlMessage.TYPE_COLLAPSE_NOTIFICATION_PANEL);
+ dos.writeByte(ControlMessage.TYPE_COLLAPSE_PANELS);
byte[] packet = bos.toByteArray();
reader.readFrom(new ByteArrayInputStream(packet));
ControlMessage event = reader.next();
- Assert.assertEquals(ControlMessage.TYPE_COLLAPSE_NOTIFICATION_PANEL, event.getType());
+ Assert.assertEquals(ControlMessage.TYPE_COLLAPSE_PANELS, event.getType());
}
@Test