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

Commit 56c9c86f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Removing custom activity dump logic" into ub-launcher3-master

parents 3a39a25d fca20151
Loading
Loading
Loading
Loading
+0 −33
Original line number Diff line number Diff line
@@ -16,46 +16,13 @@

package com.android.launcher3.uioverrides;

import android.app.Activity;
import android.app.Person;
import android.content.pm.ShortcutInfo;
import android.util.Base64;

import com.android.launcher3.Utilities;
import com.android.systemui.shared.system.ActivityCompat;

import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import java.util.zip.Deflater;

public class ApiWrapper {

    public static boolean dumpActivity(Activity activity, PrintWriter writer) {
        if (!Utilities.IS_DEBUG_DEVICE) {
            return false;
        }
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        if (!(new ActivityCompat(activity).encodeViewHierarchy(out))) {
            return false;
        }

        Deflater deflater = new Deflater();
        deflater.setInput(out.toByteArray());
        deflater.finish();

        out.reset();
        byte[] buffer = new byte[1024];
        while (!deflater.finished()) {
            int count = deflater.deflate(buffer); // returns the generated code... index
            out.write(buffer, 0, count);
        }

        writer.println("--encoded-view-dump-v0--");
        writer.println(Base64.encodeToString(
                out.toByteArray(), Base64.NO_WRAP | Base64.NO_PADDING));
        return true;
    }

    public static Person[] getPersons(ShortcutInfo si) {
        Person[] persons = si.getPersons();
        return persons == null ? Utilities.EMPTY_PERSON_ARRAY : persons;
+0 −9
Original line number Diff line number Diff line
@@ -35,13 +35,11 @@ import com.android.launcher3.logging.StatsLogUtils;
import com.android.launcher3.logging.StatsLogUtils.LogStateProvider;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.logging.UserEventDispatcher.UserEventDelegate;
import com.android.launcher3.uioverrides.ApiWrapper;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.SystemUiController;
import com.android.launcher3.util.ViewCache;
import com.android.launcher3.views.ActivityContext;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.util.ArrayList;
@@ -305,13 +303,6 @@ public abstract class BaseActivity extends Activity
        void onMultiWindowModeChanged(boolean isInMultiWindowMode);
    }

    @Override
    public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
        if (!ApiWrapper.dumpActivity(this, writer)) {
            super.dump(prefix, fd, writer, args);
        }
    }

    protected void dumpMisc(String prefix, PrintWriter writer) {
        writer.println(prefix + "deviceProfile isTransposed="
                + getDeviceProfile().isVerticalBarLayout());
+0 −7
Original line number Diff line number Diff line
@@ -16,20 +16,13 @@

package com.android.launcher3.uioverrides;

import android.app.Activity;
import android.app.Person;
import android.content.pm.ShortcutInfo;

import com.android.launcher3.Utilities;

import java.io.PrintWriter;

public class ApiWrapper {

    public static boolean dumpActivity(Activity activity, PrintWriter writer) {
        return false;
    }

    public static Person[] getPersons(ShortcutInfo si) {
        return Utilities.EMPTY_PERSON_ARRAY;
    }