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

Commit 873f757a authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Promotion of android-framework.lnx.2.0.c1-00015.

CRs      Change ID                                   Subject
--------------------------------------------------------------------------------------------------------------
1096746   I85feea7e2b4cadcfdad157e14c4eb32d96295612   Tethering : Enable/Disable IPv6 tethering feature
1101305   Ibad333bf1e15d135beca9d327ad00b12ca2784c4   Bluetooth: Fix Default BT turn on
1086937   I15910154c6df205e6d4e00bfad30a00c9e3d5bee   Camera: Expose dual camera for whitelist app
1102873   I84fa13d79a8f4b712cdc55a6d919e887b3fcaee5   Fix Crash for IpManager when verbose log enabled
1087103   Icb83591d566f67645e77c853d00b7bcf34e7fee4   Shutdown : Add factory data reset check for timezone per
1094583   Ib330c62e43b89e1119e0373d178cd2f859514328   Framework:cleanup framework res-overlay/idmap fd

Change-Id: I057abc967d32054518f0a69066dcc7a33e2f32fe
CRs-Fixed: 1096746, 1087103, 1086937, 1094583, 1101305, 1102873
parents abeb1fea 232c6701
Loading
Loading
Loading
Loading
+36 −1
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
@@ -246,13 +247,44 @@ public class Camera {
    /**
     * Returns the number of physical cameras available on this device.
     */
    public native static int getNumberOfCameras();
    public static int getNumberOfCameras() {
        boolean exposeAuxCamera = false;
        String packageName = ActivityThread.currentOpPackageName();
        /* Force to expose only two cameras
         * if the package name does not falls in this bucket
         */
        String packageList = SystemProperties.get("camera.aux.packagelist");
        if (packageList.length() > 0) {
            TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(',');
            splitter.setString(packageList);
            for (String str : splitter) {
                if (packageName.equals(str)) {
                    exposeAuxCamera = true;
                    break;
                }
            }
        }
        int numberOfCameras = _getNumberOfCameras();
        if (exposeAuxCamera == false && (numberOfCameras > 2)) {
            numberOfCameras = 2;
        }
        return numberOfCameras;
    }

    /**
     * Returns the number of physical cameras available on this device.
     */
    /** @hide */
    public native static int _getNumberOfCameras();

    /**
     * Returns the information about a particular camera.
     * If {@link #getNumberOfCameras()} returns N, the valid id is 0 to N-1.
     */
    public static void getCameraInfo(int cameraId, CameraInfo cameraInfo) {
        if(cameraId >= getNumberOfCameras()){
            throw new RuntimeException("Unknown camera ID");
        }
        _getCameraInfo(cameraId, cameraInfo);
        IBinder b = ServiceManager.getService(Context.AUDIO_SERVICE);
        IAudioService audioService = IAudioService.Stub.asInterface(b);
@@ -534,6 +566,9 @@ public class Camera {

    /** used by Camera#open, Camera#open(int) */
    Camera(int cameraId) {
        if(cameraId >= getNumberOfCameras()){
             throw new RuntimeException("Unknown camera ID");
        }
        int err = cameraInitNormal(cameraId);
        if (checkInitErrors(err)) {
            if (err == -EACCES) {
+46 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.hardware.camera2;
import android.annotation.RequiresPermission;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityThread;
import android.content.Context;
import android.hardware.ICameraService;
import android.hardware.ICameraServiceListener;
@@ -34,6 +35,8 @@ import android.os.Looper;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceSpecificException;
import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.Log;
import android.util.ArrayMap;

@@ -689,6 +692,25 @@ public final class CameraManager {

            try {
                numCameras = cameraService.getNumberOfCameras(CAMERA_TYPE_ALL);
                /* Force to expose only two cameras
                 * if the package name does not falls in this bucket
                 */
                boolean exposeAuxCamera = false;
                String packageName = ActivityThread.currentOpPackageName();
                String packageList = SystemProperties.get("camera.aux.packagelist");
                if (packageList.length() > 0) {
                    TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(',');
                    splitter.setString(packageList);
                    for (String str : splitter) {
                        if (packageName.equals(str)) {
                            exposeAuxCamera = true;
                            break;
                        }
                    }
                }
                if (exposeAuxCamera == false && (numCameras > 2)) {
                    numCameras = 2;
                }
            } catch(ServiceSpecificException e) {
                throwAsPublicException(e);
            } catch (RemoteException e) {
@@ -1016,6 +1038,30 @@ public final class CameraManager {
        }

        private void onStatusChangedLocked(int status, String id) {
            /* Force to ignore the last mono/aux camera status update
             * if the package name does not falls in this bucket
             */
            boolean exposeMonoCamera = false;
            String packageName = ActivityThread.currentOpPackageName();
            String packageList = SystemProperties.get("camera.aux.packagelist");
            if (packageList.length() > 0) {
                TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(',');
                splitter.setString(packageList);
                for (String str : splitter) {
                    if (packageName.equals(str)) {
                        exposeMonoCamera = true;
                        break;
                    }
                }
            }

            if (exposeMonoCamera == false) {
                if (Integer.parseInt(id) >= 2) {
                    Log.w(TAG, "[soar.cts] ignore the status update of camera: " + id);
                    return;
                }
            }

            if (DEBUG) {
                Log.v(TAG,
                        String.format("Camera id %s has status changed to 0x%x", id, status));
+1 −1
Original line number Diff line number Diff line
@@ -1105,7 +1105,7 @@ static void android_hardware_Camera_enableFocusMoveCallback(JNIEnv *env, jobject
//-------------------------------------------------

static const JNINativeMethod camMethods[] = {
  { "getNumberOfCameras",
  { "_getNumberOfCameras",
    "()I",
    (void *)android_hardware_Camera_getNumberOfCameras },
  { "_getCameraInfo",
+1 −1
Original line number Diff line number Diff line
@@ -359,7 +359,7 @@ private:

        void addOverlay(const String8& path, const asset_path& overlay);
        bool getOverlay(const String8& path, size_t idx, asset_path* out) const;
        
        void closeZipFromPath(const String8& zip);
    private:
        void closeZip(int idx);

+26 −2
Original line number Diff line number Diff line
@@ -804,6 +804,14 @@ void AssetManager::addSystemOverlays(const char* pathOverlaysList,
            sharedRes->add(oass, oidmap, offset + 1, false);
            const_cast<AssetManager*>(this)->mAssetPaths.add(oap);
            const_cast<AssetManager*>(this)->mZipSet.addOverlay(targetPackagePath, oap);

            oidmap->close();
            ALOGD("close idmap=%s pid=%d\n", oap.idmap.string(), getpid());
       }

        if (oap.path.find(OVERLAY_DIR) != -1) {
           const_cast<AssetManager*>(this)->mZipSet.closeZipFromPath(oap.path);
           ALOGD("close: %s and reset entry\n", oap.path.string());
      }
  }

@@ -2005,6 +2013,22 @@ AssetManager::ZipSet::~ZipSet(void)
        closeZip(i);
}

/*
 * Close a Zip file from path and reset the entry
 */
void AssetManager::ZipSet::closeZipFromPath(const String8& zip)
{
    //close zip fd
    int fd = getZip(zip)->getFileDescriptor();

    if (fd > 0) {
        close(fd);
        //reset zip object and entry
        int idx = getIndex(zip);
        mZipFile.editItemAt(idx) = NULL;
    }
}

/*
 * Close a Zip file and reset the entry.
 */
Loading