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

Commit a64b8607 authored by Android (Google) Code Review's avatar Android (Google) Code Review Committed by The Android Open Source Project
Browse files

am aa642c0c: Merge changes 1591,1596 into donut

Merge commit 'aa642c0c'

* commit 'aa642c0c':
  Get the backup calling through to the file backup helper.
  Fix typos.
  Add a new feature to android.os.Debug to add the ability to inject only specific fields when calling setFieldsOn().
  Fixes #1836075. Adds consistency checks for the View hierarchy. To enable them, you need a debug build and ViewDebug.sConsistencyCheckEnabled set to true in debug.prop. This change also lets you easily enable drawing and layout profiling in ViewRoot by setting ViewRoot.sProfileDrawing, ViewRoot.sProfileLayout and ViewRoot.sShowFps in debug.prop with a debug build.
  Add Intent.ACTION_APP_ERROR
parents 8f9ff7e7 aa642c0c
Loading
Loading
Loading
Loading
+0 −213
Original line number Diff line number Diff line
@@ -23859,219 +23859,6 @@
</field>
</class>
</package>
<package name="android.backup"
>
<class name="BackupDataOutput"
 extends="java.lang.Object"
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<constructor name="BackupDataOutput"
 type="android.backup.BackupDataOutput"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="context" type="android.content.Context">
</parameter>
<parameter name="fd" type="java.io.FileDescriptor">
</parameter>
</constructor>
<method name="close"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="flush"
 return="void"
 abstract="false"
 native="true"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="write"
 return="void"
 abstract="false"
 native="true"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="buffer" type="byte[]">
</parameter>
</method>
<method name="write"
 return="void"
 abstract="false"
 native="true"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="oneByte" type="int">
</parameter>
</method>
<method name="write"
 return="void"
 abstract="false"
 native="true"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="buffer" type="byte[]">
</parameter>
<parameter name="offset" type="int">
</parameter>
<parameter name="count" type="int">
</parameter>
</method>
<method name="writeKey"
 return="void"
 abstract="false"
 native="true"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="key" type="java.lang.String">
</parameter>
</method>
<method name="writeOperation"
 return="void"
 abstract="false"
 native="true"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="op" type="int">
</parameter>
</method>
<field name="OP_DELETE"
 type="int"
 transient="false"
 volatile="false"
 value="2"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="OP_UPDATE"
 type="int"
 transient="false"
 volatile="false"
 value="1"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="FileBackupHelper"
 extends="java.lang.Object"
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<constructor name="FileBackupHelper"
 type="android.backup.FileBackupHelper"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</constructor>
<method name="performBackup"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="true"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="context" type="android.content.Context">
</parameter>
<parameter name="oldSnapshot" type="android.os.ParcelFileDescriptor">
</parameter>
<parameter name="newSnapshot" type="android.os.ParcelFileDescriptor">
</parameter>
<parameter name="data" type="android.backup.BackupDataOutput">
</parameter>
<parameter name="files" type="java.lang.String[]">
</parameter>
</method>
</class>
<class name="SharedPreferencesBackupHelper"
 extends="java.lang.Object"
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<constructor name="SharedPreferencesBackupHelper"
 type="android.backup.SharedPreferencesBackupHelper"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</constructor>
<method name="performBackup"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="true"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="context" type="android.content.Context">
</parameter>
<parameter name="oldSnapshot" type="android.os.ParcelFileDescriptor">
</parameter>
<parameter name="newSnapshot" type="android.os.ParcelFileDescriptor">
</parameter>
<parameter name="data" type="android.backup.BackupDataOutput">
</parameter>
<parameter name="prefGroups" type="java.lang.String[]">
</parameter>
</method>
</class>
</package>
<package name="android.content"
>
<class name="AbstractCursorEntityIterator"
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ import android.content.Intent;
import android.os.Bundle;

/**
 * A conveience class to aid in implementing an AppWidget provider.
 * A convenience class to aid in implementing an AppWidget provider.
 * Everything you can do with AppWidgetProvider, you can do with a regular {@link BroadcastReceiver}.
 * AppWidgetProvider merely parses the relevant fields out of the Intent that is received in
 * {@link #onReceive(Context,Intent) onReceive(Context,Intent)}, and calls hook methods
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.content.Context;

import java.io.FileDescriptor;

/** @hide */
public class BackupDataOutput {
    /* package */ FileDescriptor fd;

+12 −5
Original line number Diff line number Diff line
@@ -75,8 +75,7 @@ public abstract class BackupService extends Service {
     *                 file.  The application should record the final backup state
     *                 here after writing the requested data to dataFd.
     */
    public abstract void onBackup(ParcelFileDescriptor oldState,
            ParcelFileDescriptor data,
    public abstract void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data,
             ParcelFileDescriptor newState);
    
    /**
@@ -92,7 +91,7 @@ public abstract class BackupService extends Service {
     *                 file.  The application should record the final backup state
     *                 here after restoring its data from dataFd.
     */
    public abstract void onRestore(ParcelFileDescriptor data, ParcelFileDescriptor newState);
    public abstract void onRestore(ParcelFileDescriptor /* TODO: BackupDataInput */ data, ParcelFileDescriptor newState);


    // ----- Core implementation -----
@@ -117,7 +116,15 @@ public abstract class BackupService extends Service {
                ParcelFileDescriptor newState) throws RemoteException {
            // !!! TODO - real implementation; for now just invoke the callbacks directly
            Log.v("BackupServiceBinder", "doBackup() invoked");
            BackupService.this.onBackup(oldState, data, newState);
            BackupDataOutput output = new BackupDataOutput(BackupService.this,
                    data.getFileDescriptor());
            try {
                BackupService.this.onBackup(oldState, output, newState);
            } catch (RuntimeException ex) {
                Log.d("BackupService", "onBackup ("
                        + BackupService.this.getClass().getName() + ") threw", ex);
                throw ex;
            }
        }

        public void doRestore(ParcelFileDescriptor data,
+26 −18
Original line number Diff line number Diff line
@@ -18,20 +18,24 @@ package android.backup;

import android.content.Context;
import android.os.ParcelFileDescriptor;
import android.util.Log;

import java.io.FileDescriptor;

/** @hide */
public class FileBackupHelper {
    private static final String TAG = "FileBackupHelper";

    /**
     * Based on oldSnapshot, determine which of the files from the application's data directory
     * need to be backed up, write them to the data stream, and fill in newSnapshot with the
     * Based on oldState, determine which of the files from the application's data directory
     * need to be backed up, write them to the data stream, and fill in newState with the
     * state as it exists now.
     */
    public static void performBackup(Context context,
            ParcelFileDescriptor oldSnapshot, ParcelFileDescriptor newSnapshot,
            BackupDataOutput data, String[] files) {
            ParcelFileDescriptor oldState, BackupDataOutput data,
            ParcelFileDescriptor newState, String[] files) {
        String basePath = context.getFilesDir().getAbsolutePath();
        performBackup_checked(basePath, oldSnapshot, newSnapshot, data, files);
        performBackup_checked(basePath, oldState, data, newState, files);
    }

    /**
@@ -39,30 +43,34 @@ public class FileBackupHelper {
     * since it's easier to do that from java.
     */
    static void performBackup_checked(String basePath,
            ParcelFileDescriptor oldSnapshot, ParcelFileDescriptor newSnapshot,
            BackupDataOutput data, String[] files) {
        if (newSnapshot == null) {
            throw new NullPointerException("newSnapshot==null");
            ParcelFileDescriptor oldState, BackupDataOutput data,
            ParcelFileDescriptor newState, String[] files) {
        if (files.length == 0) {
            return;
        }
        if (data == null) {
            throw new NullPointerException("data==null");
        if (basePath == null) {
            throw new NullPointerException();
        }
        // oldStateFd can be null
        FileDescriptor oldStateFd = oldState != null ? oldState.getFileDescriptor() : null;
        if (data.fd == null) {
            throw new NullPointerException("data.fd==null");
            throw new NullPointerException();
        }
        FileDescriptor newStateFd = newState.getFileDescriptor();
        if (newStateFd == null) {
            throw new NullPointerException();
        }
        if (files == null) {
            throw new NullPointerException("files==null");
            throw new NullPointerException();
        }

        int err = performBackup_native(basePath, oldSnapshot.getFileDescriptor(),
                newSnapshot.getFileDescriptor(), data.fd, files);
        int err = performBackup_native(basePath, oldStateFd, data.fd, newStateFd, files);

        if (err != 0) {
            throw new RuntimeException("Backup failed"); // TODO: more here
        }
    }

    native private static int performBackup_native(String basePath,
            FileDescriptor oldSnapshot, FileDescriptor newSnapshot,
            FileDescriptor data, String[] files);
    native private static int performBackup_native(String basePath, FileDescriptor oldState,
            FileDescriptor data, FileDescriptor newState, String[] files);
}
Loading