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

Commit 17db3e7b authored by Wenhao Wang's avatar Wenhao Wang Committed by Android (Google) Code Review
Browse files

Merge "[Forensic] Add BackupTransportConnector" into main

parents 56ec45a3 7e28dff2
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.security.forensic;

/** {@hide} */
parcelable ForensicEvent;
+84 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.security.forensic;

import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
import android.security.Flags;
import android.util.ArrayMap;

import java.util.Map;

/**
 * A class that represents a forensic event.
 * @hide
 */
@FlaggedApi(Flags.FLAG_AFL_API)
public final class ForensicEvent implements Parcelable {
    private static final String TAG = "ForensicEvent";

    @NonNull
    private final String mType;

    @NonNull
    private final Map<String, String> mKeyValuePairs;

    public static final @NonNull Parcelable.Creator<ForensicEvent> CREATOR =
            new Parcelable.Creator<>() {
                public ForensicEvent createFromParcel(Parcel in) {
                    return new ForensicEvent(in);
                }

                public ForensicEvent[] newArray(int size) {
                    return new ForensicEvent[size];
                }
            };

    public ForensicEvent(@NonNull String type, @NonNull Map<String, String> keyValuePairs) {
        mType = type;
        mKeyValuePairs = keyValuePairs;
    }

    private ForensicEvent(@NonNull Parcel in) {
        mType = in.readString();
        mKeyValuePairs = new ArrayMap<>(in.readInt());
        in.readMap(mKeyValuePairs, getClass().getClassLoader(), String.class, String.class);
    }

    @Override
    public void writeToParcel(@NonNull Parcel out, int flags) {
        out.writeString(mType);
        out.writeInt(mKeyValuePairs.size());
        out.writeMap(mKeyValuePairs);
    }

    @FlaggedApi(Flags.FLAG_AFL_API)
    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public String toString() {
        return "ForensicEvent{"
                + "mType=" + mType
                + ", mKeyValuePairs=" + mKeyValuePairs
                + '}';
    }
}
+41 −0
Original line number Diff line number Diff line
/*
 * Copyright 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.security.forensic;
import android.security.forensic.ForensicEvent;

import com.android.internal.infra.AndroidFuture;

/** {@hide} */
oneway interface IBackupTransport {
    /**
     * Initialize the server side.
     */
    void initialize(in AndroidFuture<int> resultFuture);

    /**
     * Send forensic logging data to the backup destination.
     * The data is a list of ForensicEvent.
     * The ForensicEvent is an abstract class that represents
     * different type of events.
     */
    void addData(in List<ForensicEvent> events, in AndroidFuture<int> resultFuture);

    /**
     * Release the binder to the server.
     */
    void release(in AndroidFuture<int> resultFuture);
}
+3 −0
Original line number Diff line number Diff line
@@ -7175,4 +7175,7 @@
    <string name="identity_check_settings_action"></string>
    <!-- Package for opening identity check settings page [CHAR LIMIT=NONE] [DO NOT TRANSLATE] -->
    <string name="identity_check_settings_package_name">com\u002eandroid\u002esettings</string>

    <!-- The name of the service for forensic backup transport. -->
    <string name="config_forensicBackupTransport" translatable="false"></string>
</resources>
+3 −0
Original line number Diff line number Diff line
@@ -5636,4 +5636,7 @@
  <!-- Identity check strings -->
  <java-symbol type="string" name="identity_check_settings_action" />
  <java-symbol type="string" name="identity_check_settings_package_name" />

  <!-- Forensic backup transport -->
  <java-symbol type="string" name="config_forensicBackupTransport" />
</resources>
Loading