Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa26a0ed authored by Felipe Leme's avatar Felipe Leme
Browse files

Refactored Shell to use IDumpstateListener.

BugreportProgressService used to poll system properties to get the
progress of the underlying dumpstate process, but now dumpstate provides
a IDumpstateListener and IDumpstateToken binder objects for the same
purpose.

Test: BugreportReceiverTest passes
Test: manual verification

BUG: 31636879

Change-Id: I81d551781a511cb1cc218a27452875b0bb267f7a
parent 7519e166
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -5,6 +5,13 @@ LOCAL_MODULE_TAGS := optional

LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_SRC_FILES += \
        ../../../native/cmds/dumpstate/binder/android/os/IDumpstate.aidl \
        ../../../native/cmds/dumpstate/binder/android/os/IDumpstateListener.aidl \
        ../../../native/cmds/dumpstate/binder/android/os/IDumpstateToken.aidl

LOCAL_AIDL_INCLUDES = frameworks/native/cmds/dumpstate/binder

LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4

LOCAL_PACKAGE_NAME := Shell
+152 −142

File changed.

Preview size limit exceeded, changes collapsed.

+8 −3
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import static com.android.shell.BugreportProgressService.EXTRA_PID;
import static com.android.shell.BugreportProgressService.EXTRA_SCREENSHOT;
import static com.android.shell.BugreportProgressService.INTENT_BUGREPORT_FINISHED;
import static com.android.shell.BugreportProgressService.INTENT_BUGREPORT_STARTED;
import static com.android.shell.BugreportProgressService.POLLING_FREQUENCY;
import static com.android.shell.BugreportProgressService.SCREENSHOT_DELAY_SECONDS;

import static org.junit.Assert.assertEquals;
@@ -65,6 +64,7 @@ import libcore.io.Streams;

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
@@ -116,7 +116,7 @@ public class BugreportReceiverTest {
    private static final String TAG = "BugreportReceiverTest";

    // Timeout for UI operations, in milliseconds.
    private static final int TIMEOUT = (int) POLLING_FREQUENCY * 4;
    private static final int TIMEOUT = (int) (5 * DateUtils.SECOND_IN_MILLIS);

    // Timeout for when waiting for a screenshot to finish.
    private static final int SAFE_SCREENSHOT_DELAY = SCREENSHOT_DELAY_SECONDS + 10;
@@ -209,6 +209,12 @@ public class BugreportReceiverTest {
        }
    }

    /*
     * TODO: this test is incomplete because:
     * - the assertProgressNotification() is not really asserting the progress because the
     *   UI automation API doesn't provide a way to check the notification progress bar value
     * - it should use the binder object instead of SystemProperties to update progress
     */
    @Test
    public void testProgress() throws Exception {
        resetProperties();
@@ -227,7 +233,6 @@ public class BugreportReceiverTest {

        // Make sure progress never goes back...
        SystemProperties.set(MAX_PROPERTY, "2000");
        sleep(POLLING_FREQUENCY + DateUtils.SECOND_IN_MILLIS);
        assertProgressNotification(NAME, 95.00f);

        SystemProperties.set(PROGRESS_PROPERTY, "1000");
+1 −1

File changed.

Contains only whitespace changes.