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

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

Merge changes I1606b184,Id78dd4ab

* changes:
  Publish StorageManager#openProxyFileDescriptor API.
  Add StorageManager#openProxyFileDescriptor.
parents 8fe4df9f 500bffdb
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -29900,6 +29900,15 @@ package android.os {
    field public static final int THREAD_PRIORITY_URGENT_DISPLAY = -8; // 0xfffffff8
  }
  public abstract class ProxyFileDescriptorCallback {
    ctor public ProxyFileDescriptorCallback();
    method public void onFsync() throws android.system.ErrnoException;
    method public long onGetSize() throws android.system.ErrnoException;
    method public int onRead(long, int, byte[]) throws android.system.ErrnoException;
    method public abstract void onRelease();
    method public int onWrite(long, int, byte[]) throws android.system.ErrnoException;
  }
  public class RecoverySystem {
    method public static void installPackage(android.content.Context, java.io.File) throws java.io.IOException;
    method public static void rebootWipeCache(android.content.Context) throws java.io.IOException;
@@ -30317,6 +30326,7 @@ package android.os.storage {
    method public boolean isEncrypted(java.io.File);
    method public boolean isObbMounted(java.lang.String);
    method public boolean mountObb(java.lang.String, java.lang.String, android.os.storage.OnObbStateChangeListener);
    method public android.os.ParcelFileDescriptor openProxyFileDescriptor(int, android.os.ProxyFileDescriptorCallback) throws java.io.IOException;
    method public boolean unmountObb(java.lang.String, boolean, android.os.storage.OnObbStateChangeListener);
    field public static final java.lang.String ACTION_MANAGE_STORAGE = "android.os.storage.action.MANAGE_STORAGE";
  }
+10 −0
Original line number Diff line number Diff line
@@ -32521,6 +32521,15 @@ package android.os {
    field public static final int THREAD_PRIORITY_URGENT_DISPLAY = -8; // 0xfffffff8
  }
  public abstract class ProxyFileDescriptorCallback {
    ctor public ProxyFileDescriptorCallback();
    method public void onFsync() throws android.system.ErrnoException;
    method public long onGetSize() throws android.system.ErrnoException;
    method public int onRead(long, int, byte[]) throws android.system.ErrnoException;
    method public abstract void onRelease();
    method public int onWrite(long, int, byte[]) throws android.system.ErrnoException;
  }
  public class RecoverySystem {
    method public static void cancelScheduledUpdate(android.content.Context) throws java.io.IOException;
    method public static void installPackage(android.content.Context, java.io.File) throws java.io.IOException;
@@ -33033,6 +33042,7 @@ package android.os.storage {
    method public boolean isEncrypted(java.io.File);
    method public boolean isObbMounted(java.lang.String);
    method public boolean mountObb(java.lang.String, java.lang.String, android.os.storage.OnObbStateChangeListener);
    method public android.os.ParcelFileDescriptor openProxyFileDescriptor(int, android.os.ProxyFileDescriptorCallback) throws java.io.IOException;
    method public boolean unmountObb(java.lang.String, boolean, android.os.storage.OnObbStateChangeListener);
    field public static final java.lang.String ACTION_MANAGE_STORAGE = "android.os.storage.action.MANAGE_STORAGE";
  }
+10 −0
Original line number Diff line number Diff line
@@ -30010,6 +30010,15 @@ package android.os {
    field public static final int THREAD_PRIORITY_URGENT_DISPLAY = -8; // 0xfffffff8
  }
  public abstract class ProxyFileDescriptorCallback {
    ctor public ProxyFileDescriptorCallback();
    method public void onFsync() throws android.system.ErrnoException;
    method public long onGetSize() throws android.system.ErrnoException;
    method public int onRead(long, int, byte[]) throws android.system.ErrnoException;
    method public abstract void onRelease();
    method public int onWrite(long, int, byte[]) throws android.system.ErrnoException;
  }
  public class RecoverySystem {
    method public static void installPackage(android.content.Context, java.io.File) throws java.io.IOException;
    method public static void rebootWipeCache(android.content.Context) throws java.io.IOException;
@@ -30428,6 +30437,7 @@ package android.os.storage {
    method public boolean isEncrypted(java.io.File);
    method public boolean isObbMounted(java.lang.String);
    method public boolean mountObb(java.lang.String, java.lang.String, android.os.storage.OnObbStateChangeListener);
    method public android.os.ParcelFileDescriptor openProxyFileDescriptor(int, android.os.ProxyFileDescriptorCallback) throws java.io.IOException;
    method public boolean unmountObb(java.lang.String, boolean, android.os.storage.OnObbStateChangeListener);
    field public static final java.lang.String ACTION_MANAGE_STORAGE = "android.os.storage.action.MANAGE_STORAGE";
  }
+19 −6
Original line number Diff line number Diff line
@@ -17,18 +17,20 @@
package android.os;

import android.system.ErrnoException;
import android.system.OsConstants;

/**
 * Callback that handles file system requests from ProxyFileDescriptor.
 * @hide
 */
public interface IProxyFileDescriptorCallback {
public abstract class ProxyFileDescriptorCallback {
    /**
     * Returns size of bytes provided by the file descriptor.
     * @return Size of bytes
     * @throws ErrnoException
     */
    long onGetSize() throws ErrnoException;
    public long onGetSize() throws ErrnoException {
        throw new ErrnoException("onGetSize", OsConstants.EBADF);
    }

    /**
     * Provides bytes read from file descriptor.
@@ -39,7 +41,9 @@ public interface IProxyFileDescriptorCallback {
     * @return Size of bytes returned by the function.
     * @throws ErrnoException
     */
    int onRead(long offset, int size, byte[] data) throws ErrnoException;
    public int onRead(long offset, int size, byte[] data) throws ErrnoException {
        throw new ErrnoException("onRead", OsConstants.EBADF);
    }

    /**
     * Handles bytes written to file descriptor.
@@ -49,11 +53,20 @@ public interface IProxyFileDescriptorCallback {
     * @return Size of bytes processed by the function.
     * @throws ErrnoException
     */
    int onWrite(long offset, int size, byte[] data) throws ErrnoException;
    public int onWrite(long offset, int size, byte[] data) throws ErrnoException {
        throw new ErrnoException("onWrite", OsConstants.EBADF);
    }

    /**
     * Processes fsync request.
     * @throws ErrnoException
     */
    void onFsync() throws ErrnoException;
    public void onFsync() throws ErrnoException {
        throw new ErrnoException("onFsync", OsConstants.EINVAL);
    }

    /**
     * Invoked after the file is closed.
     */
    abstract public void onRelease();
}
+3 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.os.storage.IObbActionListener;
import android.os.storage.StorageVolume;
import android.os.storage.VolumeInfo;
import android.os.storage.VolumeRecord;
import com.android.internal.os.AppFuseMount;

/**
 * WARNING! Update IMountService.h and IMountService.cpp if you change this
@@ -289,4 +290,6 @@ interface IStorageManager {
    void addUserKeyAuth(int userId, int serialNumber, in byte[] token, in byte[] secret) = 70;
    void fixateNewestUserKeyAuth(int userId) = 71;
    void fstrim(int flags) = 72;
    AppFuseMount mountProxyFileDescriptorBridge() = 73;
    ParcelFileDescriptor openProxyFileDescriptor(int mountPointId, int fileId, int mode) = 74;
}
Loading