oplus-fwk: Add missing classes

This commit is contained in:
pjgowtham
2024-06-29 08:40:52 +05:30
parent 45d7e3c1e1
commit ca68fbc712
4 changed files with 1178 additions and 72 deletions

View File

@@ -2,8 +2,8 @@ package android.common;
import android.common.OplusFeatureList;
/* loaded from: classes.dex */
public interface IOplusCommonFeature {
default OplusFeatureList.OplusIndex index() {
return OplusFeatureList.OplusIndex.End;
}

View File

@@ -1,8 +1,342 @@
package android.common;
/* loaded from: classes.dex */
public class OplusFeatureList {
/* loaded from: classes.dex */
public enum OplusIndex {
StartOplusOsServiceFactory,
IOplusSystemServerEx,
ICommonPowerManagerServiceEx,
IOplusAlarmManagerServiceEx,
IOplusInputMethodManagerServiceEx,
IOplusDisplayManagerServiceEx,
IOplusNetworkPolicyManagerServiceEx,
IOplusDisplayPolicyEx,
IOplusDelayRestartServicesManager,
IOplusAppStartupManager,
IOplusAppSwitchManager,
IOplusJoystickManager,
IOplusAppConfigManager,
IOplusInstallAccelerateManager,
IOplusScreenOffOptimization,
IOplusSplitScreenManager,
IOplusMultiAppManager,
IOplusMultiApp,
IOplusMultiAppUserRestoreManager,
IOplusMultiUserStatisticsManager,
IOplusMultiSystemManager,
IOplusBatterySaveExtend,
IOplusGuardElfFeature,
IOplusAccessControlLocalManager,
IOplusInterceptLockScreenWindow,
IOplusLockTaskController,
IOplusRuntimePermGrantPolicyManager,
IOplusAlarmManagerHelper,
IOplusSensitivePermGrantPolicyManager,
IOplusBroadcastManager,
IOplusFastAppManager,
IOplusAlarmTempWhitelist,
IOplusDynamicLogManager,
IOplusLanguageManager,
IOplusLanguageEnableManager,
IOplusSilentRebootManager,
IOplusWakeLockCheck,
IOplusZoomWindowManager,
IOplusPerfManager,
IOplusAthenaAmManager,
IOplusAthenaManager,
IOplusGameRotationManager,
IOplusWatermarkManager,
IOplusFullScreenDisplayManager,
IOplusEapManager,
IBatteryIdleController,
IOplusStartingWindowManager,
IOplusDarkModeMaskManager,
IOplusDarkModeServiceManager,
IOplusEdgeTouchManager,
IOplusConfineModeManager,
IOplusKeyLayoutManager,
IOplusPmsSupportedFunctionManager,
IOplusStorageAllFileAccessManager,
IOplusSaveSurfaceManager,
IOplusKeyEventManager,
IOplusWindowAnimationManager,
IOplusTransitionController,
IOplusMergedProcessSplitManager,
IOplusMirageDisplayManager,
IOplusMirageWindowManager,
IOplusWindowContainerControl,
IOplusMultiSearchWindowManager,
IOplusSeamlessAnimationManager,
IOplusTouchNodeManager,
IOplusPuttManager,
IFoldScreenSwitchingManager,
IInterruptTransitionController,
IQuickBackInputPolicy,
IThreadPriorityBoosterController,
IOplusMiscNodeManager,
IOplusResourcePreloadManager,
IOplusLatencyOptimizerManager,
IOplusGlobalDragAndDropManager,
IOplusAppOpsManager,
IOplusVFXScreenEffectFeature,
IOplusDeepThinkerExService,
IOplusScreenFrozenManager,
IOplusBootPressureHolder,
IOplusAbnormalComponentManager,
IOplusVerificationCodeController,
IOplusVisionCorrectionManager,
IOplusCustomizePmsFeature,
IOplusCOTAFeature,
IOplusClipboardNotifyManager,
IOplusBootTraceManager,
IOplusScrollToTopSystemManager,
IOplusCarModeManager,
IOplusPinFileManager,
IOplusOsenseCommonManager,
IOplusBracketModeManager,
IOplusDisableWindowLayoutInfoManager,
IOplusQuickReplyManager,
IOplusCompactWindowManagerService,
IOplusEmbeddingManagerService,
IOplusAutoLayoutSystemServer,
IOplusRGBNormalizeSystemServer,
IOplusResourcesManagerSystemServer,
IOplusSquareDisplayOrientationManager,
IOplusFlipDisplayOrientationManager,
IOplusAlwaysAliveManager,
IOplusRecommendPermissionManager,
IOplusCompatModeManager,
IOplusActivityPreloadManager,
IOplusSlcDispatchManager,
IOplusShoulderKeyManager,
IOplusAppHeapSystemManager,
EndOplusOsServiceFactory,
StartOplusOsFrameworkFactory,
IOplusViewRootUtil,
IOplusFontManager,
IOplusFavoriteManager,
IOplusDarkModeManager,
IOplusDirectViewHelper,
IOplusCommonInjector,
IOplusTextViewRTLUtilForUG,
IOplusViewHooks,
IOplusScreenShotEuclidManager,
IOplusInputMethodServiceUtils,
IOplusResolverManager,
IOplusThemeManager,
IOplusAccidentallyTouchHelper,
IOplusOverScrollerHelper,
IOplusScrollOptimizationHelper,
IOplusListHooks,
IOplusGradientHooks,
ITextJustificationHooks,
IOplusMagnifierHooks,
IOplusNotificationUiManager,
IOplusDeepThinkerManager,
IOplusBurmeseZgHooks,
IOplusViewConfigHelper,
IOplusThemeStyle,
IOplusIconPackManager,
IOplusEyeProtectManager,
IOplusAppDynamicFeatureManager,
IOplusListManager,
IOplusFloatingToolbarUtil,
IOplusDragTextShadowHelper,
IOplusDailyBattProtoManager,
IOplusPermissionCheckInjector,
IOplusEnterpriseAndOperatorFeature,
IOplusCustomizeTextViewFeature,
IUxIconPackageManagerExt,
IOplusScrollToTopManager,
IOplusCursorFeedbackManager,
IOplusReorderActionMenuManager,
IOplusAutoLayoutManager,
IOplusRGBNormalizeManager,
IOplusViewDebugManager,
IOplusViewExtractManager,
IOplusCompactWindowAppManager,
IOplusClipboardController,
IOplusAppHeapManager,
EndOplusOsFrameworkFactory,
StartOplusServiceFactory,
IOplusLocationBlacklistUtil,
IOplusLocationStatistics,
IOplusLBSMainClass,
IOplusActivityManagerServiceEx,
IOplusActivityTaskManagerServiceEx,
IOplusPackageManagerServiceEx,
IOplusPackageManagerNativeEx,
IOplusWindowManagerServiceEx,
IOplusPowerManagerServiceEx,
IOplusBackupManagerServiceEx,
IOplusFeatureAOD,
IOplusHeadsetFadeIn,
IOplusAlertSliderManager,
IOplusCameraStartupOptimization,
IOplusDnsSelfrecoveryEngine,
IOplusConnectivityServiceHelperUtils,
IOplusWifiConnectRestriction,
IOplusVpnHelper,
IOplusNecManager,
IOplusNecConnectMonitor,
IOplusVpnManager,
IOplusShutdownFeature,
IOplusFeatureDCBacklight,
IOplusFeatureHDREnhanceBrightness,
IOplusFeatureMEMC,
IOplusFeatureMEMCGame,
IOplusFeatureBrightnessBarController,
IORBrightnessMarvelsDataCollector,
IOplusUsbDeviceFeature,
IOplusSkipDoframeFeature,
IOplusStorageManagerFeature,
IOplusBatteryServiceFeature,
IOplusNewNetworkTimeUpdateServiceFeature,
IOplusActivityManagerDynamicLogConfigFeature,
IOplusAppRunningControllerFeatrue,
IOplusAmsUtilsFeatrue,
IOplusWmsUtilsFeatrue,
IOplusResolutionManagerFeature,
IOplusDynamicVsyncManagerFeature,
ICompatibilityHelper,
IOplusPowerManagerServiceFeature,
IOplusFeatureConfigManagerInternal,
IOplusEngineerService,
IOplusScreenCastContentManager,
IOplusScreenFrozenBooster,
IOplusKeepAliveManager,
IOplusDualHeadPhoneFeature,
IOplusFloatingWindow,
IOplusDexOptimizeManager,
IOplusDexSceneManager,
IOplusThirdPartyAppSignCheckManager,
IOplusForbidUninstallAppManager,
IOplusAppInstallProgressManager,
IOplusPermSupportedFunctionManager,
IOplusRemovableAppManager,
IOplusAppQuickFreezeManager,
IOplusDisablePackageManager,
IOplusAppDetectManager,
IOplusAppListInterceptManager,
IOplusChildrenModeInstallManager,
IOplusClearDataProtectManager,
IOplusDataFreeManager,
IOplusDefaultAppPolicyManager,
IOplusDexMetadataManager,
IOplusDynamicFeatureManager,
IOplusFixupDataManager,
IOplusForbidHideOrDisableManager,
IOplusFullmodeManager,
IOplusIconCachesManager,
IOplusInstallThreadsControlManager,
IOplusPackageInstallInterceptManager,
IOplusPackageInstallStatisticManager,
IOplusPkgStartInfoManager,
IOplusSecurePayManager,
IOplusSellModeManager,
IOplusSystemAppProtectManager,
IOplusPermissionManagerServiceEx,
IOplusAppDataMigrateManager,
IOplusSecurityPermissionManager,
IOplusOptimizingProgressManager,
IOplusScreenOffTorchHelper,
IOplusBackgroundTaskManagerService,
IFreezeManagerHelp,
IFreezeManagerService,
IOplusSensorControlFeature,
IOplusSecurityAnalysisBroadCastSender,
IOplusPerformanceService,
IOplusFoldingAngleManager,
IOplusSysStateManager,
IOplusRefreshRatePolicy,
IOplusCarrierManager,
IOplusDataNormalizationManager,
IOplusPkgStateDetectFeature,
IOplusHansManager,
IOplusSceneManager,
IOplusCpuLimitManager,
IOGuardManager,
IOplusNewFeaturesDisplayingManager,
IOplusLooperStatsManager,
IOplusAppDetailsManager,
IOplusBackupManagerHelper,
IOplusBackupTaskManager,
EndOplusServiceFactory,
StartOplusFrameworkFactory,
IOplusZenModeFeature,
IOplusAutoResolutionFeature,
IOplusDynamicVsyncFeature,
IOplusRotationOptimization,
IOplusUIFirstManager,
IOplusResourceManager,
IJankManager,
IOAppNetControlManager,
IOplusPreLoadSplashManager,
IOplusPerformanceManager,
IOplusCameraUtils,
IOplusCameraStatisticsManager,
IOplusCamera2StatisticsManager,
IOplusCameraStateBroadcast,
IOplusCameraManager,
IOplusHiddenApiManagerExt,
EndOplusFrameworkFactory,
StartOplusJobSchedulerServiceFactory,
IOplusJobTest,
IOplusJobSchedulerSystemServerEx,
IOplusJobSchedulerServiceEx,
IJobCountPolicy,
IOplusJobScheduleManager,
IOplusDeviceIdleHelper,
IOplusGoogleDozeRestrict,
IOplusDeviceIdleControllerEx,
IOplusSmartDozeHelper,
IOplusAlarmWakeupDetection,
IOplusAlarmManagerServiceHelper,
IOplusAlarmAlignment,
IOplusGoogleAlarmRestrict,
IOplusDeepSleepHelper,
EndOplusJobSchedulerServiceFactory,
IOplusResolverStyle,
StartCustomizeFrameworkFactory,
ICustomizeTransformHelper,
EndCustomizeFrameworkFactory,
StartCustomizeServiceFactory,
ICustomizeTransformManager,
EndCustomizeServiceFactory,
IOplusGameSpaceToolBoxManager,
IOplusWLBManager,
IOplusSystemUIInjector,
IOplusAODScreenshotManager,
StartSpliceCustomizeFrameworkFactory,
ISpliceCustomizeTransformHelper,
EndSpliceCustomizeFrameworkFactory,
StartSpliceCustomizeServiceFactory,
ISpliceCustomizeTransformManager,
EndSpliceCustomizeServiceFactory,
StartAOSPExtensionPluginFactory,
ITypefaceExt,
IAdaptiveIconDrawableExt,
IAbsListViewExt,
IResourcesImplExt,
IResourcesManagerExt,
IResourcesExt,
IOplusWallpaperManagerEx,
IOplusWallpaperServiceExt,
IAlertControllerExt,
IAlertParamsExt,
IResolverActivityExt,
IResolverListAdapterExt,
ILoadIconTaskExt,
IResolverDrawerLayoutExt,
ILockSettingsExt,
IOverlayManagerServiceEx,
EndAOSPExtensionPluginFactory,
IOplusNetworkStatsEx,
IOplusNetworkManagement,
IOplusNetdEventListener,
IOplusCustomizeVpnManager,
End
}
}

View File

@@ -0,0 +1,66 @@
package android.hardware.camera2;
import android.common.IOplusCommonFeature;
import android.common.OplusFeatureList;
import android.content.Context;
import android.os.IBinder;
/* loaded from: classes.dex */
public interface IOplusCameraManager extends IOplusCommonFeature {
public static final IOplusCameraManager DEFAULT = new IOplusCameraManager() { // from class: android.hardware.camera2.IOplusCameraManager.1
};
public static final String NAME = "IOplusCameraManager";
/* loaded from: classes.dex */
public enum Cmd {
CMD_NONE,
CMD_PRE_CAPTURE,
CMD_PRE_OPEN,
CMD_PRE_EVLIST,
CMD_READ_MEM
}
default OplusFeatureList.OplusIndex index() {
return OplusFeatureList.OplusIndex.IOplusCameraManager;
}
default IOplusCommonFeature getDefault() {
return DEFAULT;
}
default void addAuthResultInfo(Context context, int uid, int pid, int permBits, String packageName) {
}
default void setDeathRecipient(IBinder client) {
}
default boolean isAuthedClient(Context context) {
return false;
}
default void preOpenCamera(Context context) {
}
default void sendOplusExtCamCmd(Context context, Cmd cmd, int[] param) {
}
default void setCallInfo() {
}
default void saveOpPackageName(String packageName) {
}
default void setPackageName() {
}
default boolean isPrivilegedApp(String packageName) {
return false;
}
default boolean isCameraUnitSession() {
return false;
}
default void parseSessionParameters(CaptureRequest sessionParams) {
}
}

View File

@@ -1,105 +1,472 @@
package android.hardware.camera2;
import android.content.Context;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.IOplusCameraManager;
import android.hardware.camera2.impl.CameraMetadataNative;
import android.media.Image;
import android.media.ImageReader;
import android.os.Binder;
import android.os.IBinder;
import android.os.Parcel;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.util.Log;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class OplusCameraManager {
/* loaded from: classes.dex */
public final class OplusCameraManager implements IOplusCameraManager {
private static final String PERMISSION_SAFE_CAMERA = "com.oplus.permission.safe.CAMERA";
private static final String PERMISSION_SATELLITE_COMMUNICATION = "com.oplus.permission.safe.SATELLITE_COMMUNICATION";
public static final int READ_CAMERA_SERVER_MEMORY_INFO = 1;
public static final int READ_HAL_MEMORY_INFO = 0;
public static final int STATELLITE_CALL_STATUS_CALLING = 1;
public static final int STATELLITE_CALL_STATUS_IDLE = 0;
private static final String TAG = "OplusCameraManager";
private static final String SYSTEM_CAMERA_PACKNAME = SystemProperties.get("ro.oplus.system.camera.name");
private static final CaptureRequest.Key<byte[]> KEY_OPLUS_PACKAGE = new CaptureRequest.Key<>("com.oplus.is.sdk.camera.package", byte[].class);
private static OplusCameraManager mInstance = new OplusCameraManager();
private static String[] SET_PACKAGE_BLACK_LIST = {"com.oplus.battery", "com.oplus.onetrace", "com.android.systemui", "com.oplus.obrain"};
private String mOpPackageName = "";
private boolean mIsCameraUnitSession = false;
private boolean mbLoad = false;
private static OplusCameraManager sOplusCameraManager = null;
public native int nativeSendToAttachHWBufToBufQEvent(long j);
public static OplusCameraManager getInstance() {
if (sOplusCameraManager == null) {
sOplusCameraManager = new OplusCameraManager();
}
return sOplusCameraManager;
public native int nativeSendToBufQAllocEnableEvent(long j);
public native int nativeSendToExchgHWBufBtwBufQEvent(long j);
public native void nativtSendToProcessHeif(long j);
private OplusCameraManager() {
}
public void preOpenCamera(Context context) {
if (context == null) {
throw new IllegalArgumentException("context was null");
private void checkLoadLibrary() {
Log.i(TAG, "checkLoadHeifLibbrary, mbLoad: " + this.mbLoad);
if (this.mbLoad) {
return;
}
try {
OplusCameraManagerGlobal.get().preOpenCamera(context.getOpPackageName());
} catch (CameraAccessException | RemoteException e) {
System.loadLibrary("HeifWinBufExchg-jni");
this.mbLoad = true;
} catch (Exception e) {
e.printStackTrace();
Log.e(TAG, "checkLoadHeifLibbrary, error");
}
}
public void setCallInfo() {
public void sendToProcessHeif(long ptr) {
checkLoadLibrary();
nativtSendToProcessHeif(ptr);
}
public int sendToBufQAllocEnableEvent(long ptr) {
checkLoadLibrary();
return nativeSendToBufQAllocEnableEvent(ptr);
}
public int sendToExchgHWBufBtwBufQEvent(long ptr) {
checkLoadLibrary();
return nativeSendToExchgHWBufBtwBufQEvent(ptr);
}
public int sendToAttachHWBufToBufQEvent(long ptr) {
checkLoadLibrary();
return nativeSendToAttachHWBufToBufQEvent(ptr);
}
public static synchronized OplusCameraManager getInstance() {
OplusCameraManager oplusCameraManager;
synchronized (OplusCameraManager.class) {
oplusCameraManager = mInstance;
}
return oplusCameraManager;
}
public static Object getEmptyCameraMetadataNative(long[] metadataPtr) {
CameraMetadataNative meta = new CameraMetadataNative();
if (metadataPtr != null && metadataPtr.length > 0) {
metadataPtr[0] = meta.getMetadataPtr();
}
return meta;
}
public static TotalCaptureResult generateTotalCaptureResult(Object meta, long frameId) {
if (meta == null || !(meta instanceof CameraMetadataNative)) {
return null;
}
TotalCaptureResult r = new TotalCaptureResult((CameraMetadataNative) meta, 0);
try {
OplusCameraManagerGlobal.get().setCallInfo();
} catch (CameraAccessException | RemoteException e) {
Field numField = CaptureResult.class.getDeclaredField("mFrameNumber");
numField.setAccessible(true);
numField.setLong(r, frameId);
} catch (IllegalAccessException | NoSuchFieldException e) {
e.printStackTrace();
}
return r;
}
@Override // android.hardware.camera2.IOplusCameraManager
public void addAuthResultInfo(Context context, int uid, int pid, int permBits, String packageName) {
context.enforceCallingOrSelfPermission(PERMISSION_SAFE_CAMERA, TAG);
if (uid == 0) {
throw new IllegalArgumentException("uid was 0, which is illegal.");
}
if (pid == 0) {
throw new IllegalArgumentException("pid was 0, which is illegal.");
}
if (packageName == null) {
throw new IllegalArgumentException("packageName was null, which is illegal.");
}
try {
OplusCameraManagerGlobal.get().addAuthResultInfo(uid, pid, permBits, packageName);
} catch (CameraAccessException e) {
e.printStackTrace();
} catch (RemoteException e2) {
e2.printStackTrace();
}
}
@Override // android.hardware.camera2.IOplusCameraManager
public void setDeathRecipient(IBinder client) {
if (client == null) {
throw new IllegalArgumentException("client was null");
}
try {
OplusCameraManagerGlobal.get().setDeathRecipient(client);
} catch (CameraAccessException | RemoteException e) {
} catch (CameraAccessException e) {
e.printStackTrace();
} catch (RemoteException e2) {
e2.printStackTrace();
}
}
@Override // android.hardware.camera2.IOplusCameraManager
public boolean isAuthedClient(Context context) {
if (context == null) {
throw new IllegalArgumentException("context was null");
}
try {
return OplusCameraManagerGlobal.get().isAuthedClient(context.getOpPackageName());
} catch (CameraAccessException e) {
e.printStackTrace();
return false;
} catch (RemoteException e2) {
e2.printStackTrace();
return false;
}
}
@Override // android.hardware.camera2.IOplusCameraManager
public void preOpenCamera(Context context) {
if (context == null) {
throw new IllegalArgumentException("context was null");
}
context.enforceCallingOrSelfPermission(PERMISSION_SAFE_CAMERA, TAG);
try {
OplusCameraManagerGlobal.get().preOpenCamera(context.getOpPackageName());
} catch (CameraAccessException e) {
e.printStackTrace();
} catch (RemoteException e2) {
e2.printStackTrace();
}
}
@Override // android.hardware.camera2.IOplusCameraManager
public void sendOplusExtCamCmd(Context context, IOplusCameraManager.Cmd cmd, int[] param) {
if (context == null) {
throw new IllegalArgumentException("context was null");
}
context.enforceCallingOrSelfPermission(PERMISSION_SAFE_CAMERA, TAG);
try {
OplusCameraManagerGlobal.get().sendOplusExtCamCmd(context.getOpPackageName(), cmd, param);
} catch (CameraAccessException e) {
e.printStackTrace();
} catch (RemoteException e2) {
e2.printStackTrace();
}
}
public void readMemoryInfo(IOplusCameraManager.Cmd cmd, StringBuilder result, int model) {
try {
OplusCameraManagerGlobal.get().readMemoryInfo(cmd, result, model);
} catch (CameraAccessException e) {
Log.e(TAG, "readOplusMemory, CameraAccessException: " + e);
} catch (RemoteException e2) {
Log.e(TAG, "readOplusMemory, RemoteException: " + e2);
}
}
@Override // android.hardware.camera2.IOplusCameraManager
public void setCallInfo() {
try {
OplusCameraManagerGlobal.get().setCallInfo();
} catch (CameraAccessException e) {
e.printStackTrace();
} catch (RemoteException e2) {
e2.printStackTrace();
}
}
@Override // android.hardware.camera2.IOplusCameraManager
public void saveOpPackageName(String packageName) {
this.mOpPackageName = packageName;
Log.i(TAG, "saveOpPackageName, mOpPackageName: " + this.mOpPackageName);
}
@Override // android.hardware.camera2.IOplusCameraManager
public void setPackageName() {
for (String packageName : SET_PACKAGE_BLACK_LIST) {
if (packageName.equals(this.mOpPackageName)) {
return;
}
}
try {
OplusCameraManagerGlobal.get().setClientInfo(this.mOpPackageName, Binder.getCallingUid(), Binder.getCallingPid());
} catch (CameraAccessException e) {
e.printStackTrace();
} catch (RemoteException e2) {
e2.printStackTrace();
}
}
public void setRIOClientInfo() throws CameraAccessException {
Log.i(TAG, "uid = " + Binder.getCallingUid() + ", pid = " + Binder.getCallingPid());
try {
OplusCameraManagerGlobal.get().setRIOClientInfo(Binder.getCallingUid(), Binder.getCallingPid());
} catch (RemoteException e) {
e.printStackTrace();
}
}
private static final class OplusCameraManagerGlobal implements IBinder.DeathRecipient {
public void unRegisterCameraDeviceCallback(Context context) throws CameraAccessException {
if (context == null) {
throw new IllegalArgumentException("context was null");
}
Log.i(TAG, "unRegisterCameraDeviceCallback, packageName = " + context.getOpPackageName());
try {
OplusCameraManagerGlobal.get().unRegisterCameraDeviceCallback(context.getOpPackageName());
} catch (RemoteException e) {
e.printStackTrace();
}
}
private static final String TAG = "OplusCameraManagerGlobal";
public void setDeathRecipient(Context context, IBinder client) {
if (context == null) {
throw new IllegalArgumentException("context was null");
}
if (client == null) {
throw new IllegalArgumentException("client was null");
}
try {
OplusCameraManagerGlobal.get().setDeathRecipient(context.getOpPackageName(), client);
} catch (CameraAccessException e) {
e.printStackTrace();
} catch (RemoteException e2) {
e2.printStackTrace();
}
}
public void setSatelliteCallStatus(Context context, int status) throws CameraAccessException {
if (context == null) {
throw new IllegalArgumentException("context was null");
}
try {
OplusCameraManagerGlobal.get().setSatelliteCallStatus(context.getOpPackageName(), status);
} catch (RemoteException e) {
e.printStackTrace();
}
}
@Override // android.hardware.camera2.IOplusCameraManager
public boolean isPrivilegedApp(String packageName) {
String str;
if (packageName == null || (str = SYSTEM_CAMERA_PACKNAME) == null || !str.equals(packageName)) {
return false;
}
return true;
}
public void setTorchIntensity(int torchIntensity) {
if (torchIntensity < 0) {
throw new IllegalArgumentException("torchIntensity was less than 0, which is illegal.");
}
try {
OplusCameraManagerGlobal.get().setTorchIntensity(torchIntensity);
} catch (CameraAccessException e) {
e.printStackTrace();
} catch (RemoteException e2) {
e2.printStackTrace();
}
}
public void disconnectClients() {
try {
OplusCameraManagerGlobal.get().disconnectClients();
} catch (CameraAccessException e) {
e.printStackTrace();
} catch (RemoteException e2) {
e2.printStackTrace();
}
}
public boolean isClientConnected() {
try {
return OplusCameraManagerGlobal.get().isClientConnected();
} catch (CameraAccessException e) {
e.printStackTrace();
return false;
} catch (RemoteException e2) {
e2.printStackTrace();
return false;
}
}
@Override // android.hardware.camera2.IOplusCameraManager
public boolean isCameraUnitSession() {
return this.mIsCameraUnitSession;
}
@Override // android.hardware.camera2.IOplusCameraManager
public void parseSessionParameters(CaptureRequest sessionParams) {
if (sessionParams == null) {
setIsCameraUnitSession(false);
return;
}
byte[] result = (byte[]) sessionParams.get(KEY_OPLUS_PACKAGE);
if (result == null || result.length == 0) {
setIsCameraUnitSession(false);
return;
}
if (1 == result[0]) {
setIsCameraUnitSession(true);
}
Log.i(TAG, "parseSessionParameters mIsCameraUnitSession: " + this.mIsCameraUnitSession);
}
public void oplusDetachImage(Image image, ImageReader imgreader) {
try {
Method method = ImageReader.class.getDeclaredMethod("detachImage", Image.class);
method.setAccessible(true);
method.invoke(imgreader, image);
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
e.printStackTrace();
}
Log.i(TAG, "using reflection to visit detachImage method in ImageReader");
}
public static void setOmojiJson(String jsonInfo) {
Log.i(TAG, "setOmojiJson called.");
if (jsonInfo == null || "".equals(jsonInfo)) {
Log.i(TAG, "jsonInfo is null");
return;
}
try {
OplusCameraManagerGlobal.get().setOmojiJson(jsonInfo);
} catch (CameraAccessException e) {
Log.i(TAG, "setOmojiJson :" + e.getMessage());
} catch (RemoteException e2) {
Log.i(TAG, "setOmojiJson :" + e2.getMessage());
}
}
public void closeAON() throws CameraAccessException {
Log.i(TAG, "uid = " + Binder.getCallingUid() + ", pid = " + Binder.getCallingPid());
try {
OplusCameraManagerGlobal.get().closeAON();
} catch (RemoteException e) {
e.printStackTrace();
}
}
private void setIsCameraUnitSession(boolean isCameraUnitSession) {
this.mIsCameraUnitSession = isCameraUnitSession;
try {
OplusCameraManagerGlobal.get().setIsCameraUnitSession(this.mIsCameraUnitSession);
} catch (CameraAccessException e) {
e.printStackTrace();
} catch (RemoteException e2) {
e2.printStackTrace();
}
}
/* JADX INFO: Access modifiers changed from: private */
/* loaded from: classes.dex */
public static final class OplusCameraManagerGlobal implements IBinder.DeathRecipient {
private static final int ADD_AUTH_RESULT = 10001;
private static final String CAMERA_SERVICE_BINDER_NAME = "media.camera";
private static final String DESCRIPTOR = "android.hardware.media";
private static final int SET_DEATH_RECIPIENT = 10002;
private static final int CLIENT_IS_AUTHED = 10004;
private static final int CLOSE_AON = 10013;
private static final int CONNECT_STATUS = 10011;
private static final String DESCRIPTOR = "android.hardware.camera";
private static final int DISCONNECT_CLIENTS = 10009;
private static final int OPEN_AON = 10012;
private static final int OPLUS_CAMERA_FIRST_CALL_TRANSACTION = 10000;
private static final int PRE_OPEN_CAMERA = 10014;
private static final int READ_OPLUS_CAMERA_SERVER_MEMORY = 10018;
private static final int READ_OPLUS_HAL_MEMORY = 10017;
private static final int REGISTER_CAMERA_DEVICE_CALLBACK = 10019;
private static final int SEND_OPLUS_EXT_CAM_CMD = 10015;
private static final int SET_CALL_INFO = 10006;
private static final int PRE_OPEN_CAMERA = 10012;
private static final OplusCameraManagerGlobal gOplusCameraManagerGlobal =
new OplusCameraManagerGlobal();
private static final boolean sCameraServiceDisabled =
SystemProperties.getBoolean("config.disable_cameraservice", false);
private static final int SET_CLIENT_INFO = 10005;
private static final int SET_DEATH_RECIPIENT = 10002;
private static final int SET_DEATH_RECIPIENT_FOR_NAME = 10022;
private static final int SET_IS_CAMERA_UNIT_SESSION = 10016;
private static final int SET_OMOJI_JSON = 10010;
private static final int SET_PACKAGE_NAME = 10003;
private static final int SET_RIO_CLIENT_INFO = 10007;
private static final int SET_SATELLITE_CALL_STATE = 10021;
private static final int SET_TORCH_INTENSITY = 10008;
private static final String TAG = "OplusCameraManagerGlobal";
private static final int UNREGISTER_CAMERA_DEVICE_CALLBACK = 10020;
private static final OplusCameraManagerGlobal gCameraManager = new OplusCameraManagerGlobal();
public static final boolean sCameraServiceDisabled = SystemProperties.getBoolean("config.disable_cameraservice", false);
private final boolean DEBUG = false;
private final Object mLock = new Object();
private IBinder mRemote = null;
private OplusCameraManagerGlobal() {
}
public static OplusCameraManagerGlobal get() {
return gOplusCameraManagerGlobal;
return gCameraManager;
}
private void connectCameraServiceLocked() {
if (mRemote != null || sCameraServiceDisabled) {
if (this.mRemote != null || sCameraServiceDisabled) {
return;
}
mRemote = ServiceManager.getService(CAMERA_SERVICE_BINDER_NAME);
if (mRemote != null) {
try {
mRemote.linkToDeath(this, 0);
} catch (RemoteException e) {
Log.e(TAG, "link to death failed");
}
Log.i(TAG, "Connecting to camera service");
IBinder service = ServiceManager.getService(CAMERA_SERVICE_BINDER_NAME);
this.mRemote = service;
if (service == null) {
return;
}
try {
service.linkToDeath(this, 0);
} catch (RemoteException e) {
}
}
public IBinder getCameraServiceRemote() {
synchronized (mLock) {
IBinder iBinder;
synchronized (this.mLock) {
connectCameraServiceLocked();
if (mRemote == null && !sCameraServiceDisabled) {
if (this.mRemote == null && !sCameraServiceDisabled) {
Log.e(TAG, "Camera service is unavailable");
}
iBinder = this.mRemote;
}
return mRemote;
return iBinder;
}
public void preOpenCamera(String packageName) throws CameraAccessException, RemoteException {
final IBinder remote = getCameraServiceRemote();
public void addAuthResultInfo(int uid, int pid, int permBits, String packageName) throws CameraAccessException, RemoteException {
Log.e(TAG, "addAuthResultInfo");
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
@@ -107,29 +474,11 @@ public class OplusCameraManager {
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
data.writeInt(1);
mRemote.transact(PRE_OPEN_CAMERA, data, reply, 0);
reply.readException();
data.recycle();
reply.recycle();
Log.i(TAG, "preOpenCamera, the " + packageName + " preOpenSend");
} catch (Throwable th) {
data.recycle();
reply.recycle();
throw th;
}
}
public void setCallInfo() throws CameraAccessException, RemoteException {
final IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
mRemote.transact(SET_CALL_INFO, data, reply, 0);
data.writeInt(uid);
data.writeInt(pid);
data.writeInt(permBits);
data.writeString(packageName);
this.mRemote.transact(10001, data, reply, 0);
reply.readException();
} finally {
data.recycle();
@@ -138,7 +487,8 @@ public class OplusCameraManager {
}
public void setDeathRecipient(IBinder client) throws CameraAccessException, RemoteException {
final IBinder remote = getCameraServiceRemote();
Log.e(TAG, "setDeathRecipient");
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
@@ -147,7 +497,7 @@ public class OplusCameraManager {
try {
data.writeInterfaceToken(DESCRIPTOR);
data.writeStrongBinder(client);
mRemote.transact(SET_DEATH_RECIPIENT, data, reply, 0);
this.mRemote.transact(10002, data, reply, 0);
reply.readException();
} finally {
data.recycle();
@@ -155,9 +505,365 @@ public class OplusCameraManager {
}
}
@Override
public boolean isAuthedClient(String packageName) throws CameraAccessException, RemoteException {
Log.e(TAG, "isAuthedClient, need check packageName: " + packageName);
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
data.writeString(packageName);
this.mRemote.transact(10004, data, reply, 0);
reply.readException();
boolean isAuthed = reply.readBoolean();
data.recycle();
reply.recycle();
Log.e(TAG, "isAuthedClient, the " + packageName + " is Authed " + isAuthed);
return isAuthed;
} catch (Throwable th) {
data.recycle();
reply.recycle();
throw th;
}
}
public void preOpenCamera(String packageName) throws CameraAccessException, RemoteException {
Log.e(TAG, "preOpenCamera, need check packageName: " + packageName);
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
data.writeInt(1);
this.mRemote.transact(10014, data, reply, 0);
reply.readException();
data.recycle();
reply.recycle();
Log.e(TAG, "preOpenCamera, the " + packageName + " preOpenSend ");
} catch (Throwable th) {
data.recycle();
reply.recycle();
throw th;
}
}
public void sendOplusExtCamCmd(String packageName, IOplusCameraManager.Cmd cmd, int[] param) throws CameraAccessException, RemoteException {
Log.e(TAG, "sendOplusExtCamCmd, packageName: " + packageName + ", cmd: " + cmd);
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
data.writeInt(cmd.ordinal());
data.writeIntArray(param);
this.mRemote.transact(10015, data, reply, 1);
reply.readException();
data.recycle();
reply.recycle();
Log.e(TAG, "sendOplusExtCamCmd complete ");
} catch (Throwable th) {
data.recycle();
reply.recycle();
throw th;
}
}
public void readMemoryInfo(IOplusCameraManager.Cmd cmd, StringBuilder result, int model) throws CameraAccessException, RemoteException {
Log.i(TAG, "readMemoryInfo, cmd: " + cmd);
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInt(cmd.ordinal());
this.mRemote.transact(model == 0 ? 10017 : 10018, data, reply, 0);
byte[] byteArray = reply.createByteArray();
String res = new String(byteArray);
result.append(res);
data.recycle();
reply.recycle();
Log.i(TAG, "readMemoryInfo complete");
} catch (Throwable th) {
data.recycle();
reply.recycle();
throw th;
}
}
public void setCallInfo() throws CameraAccessException, RemoteException {
Log.e(TAG, "setCallInfo");
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
this.mRemote.transact(10006, data, reply, 0);
reply.readException();
} finally {
data.recycle();
reply.recycle();
}
}
public void setPackageName(String packageName) throws CameraAccessException, RemoteException {
Log.i(TAG, "setPackageName");
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
data.writeString(packageName);
remote.transact(10003, data, reply, 0);
reply.readException();
} finally {
data.recycle();
reply.recycle();
}
}
public void setClientInfo(String packageName, int uid, int pid) throws CameraAccessException, RemoteException {
Log.i(TAG, "setClientInfo, packageName: " + packageName + ", uid: " + uid + ", pid: " + pid);
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
data.writeString(packageName);
data.writeInt(uid);
data.writeInt(pid);
remote.transact(10005, data, reply, 0);
reply.readException();
} finally {
data.recycle();
reply.recycle();
}
}
public void setRIOClientInfo(int uid, int pid) throws CameraAccessException, RemoteException {
Log.i(TAG, "uid: " + uid + ", pid: " + pid);
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
data.writeInt(uid);
data.writeInt(pid);
remote.transact(10007, data, reply, 0);
reply.readException();
} finally {
data.recycle();
reply.recycle();
}
}
public void unRegisterCameraDeviceCallback(String packageName) throws CameraAccessException, RemoteException {
Log.i(TAG, "unRegisterCameraDeviceCallback");
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
data.writeString(packageName);
this.mRemote.transact(10020, data, reply, 0);
reply.readException();
} finally {
data.recycle();
reply.recycle();
}
}
public void setDeathRecipient(String packageName, IBinder client) throws CameraAccessException, RemoteException {
Log.i(TAG, "setDeathRecipient");
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
data.writeString(packageName);
data.writeStrongBinder(client);
this.mRemote.transact(10022, data, reply, 0);
reply.readException();
} finally {
data.recycle();
reply.recycle();
}
}
public void setSatelliteCallStatus(String packageName, int status) throws CameraAccessException, RemoteException {
Log.i(TAG, "setSatelliteCallStatus, status: " + status);
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
data.writeString(packageName);
data.writeInt(status);
remote.transact(10021, data, reply, 0);
reply.readException();
} finally {
data.recycle();
reply.recycle();
}
}
public void setOmojiJson(String atavatarInfo) throws CameraAccessException, RemoteException {
Log.i(TAG, "setOmojiJson E");
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
data.writeString(atavatarInfo);
Log.i(TAG, "setOmojiJson process E");
this.mRemote.transact(10010, data, reply, 0);
Log.i(TAG, "setOmojiJson process X");
reply.readException();
data.recycle();
reply.recycle();
Log.i(TAG, "setOmojiJson X");
} catch (Throwable th) {
data.recycle();
reply.recycle();
throw th;
}
}
public void setTorchIntensity(int torchIntensity) throws CameraAccessException, RemoteException {
Log.d(TAG, "setTorchIntensity: " + torchIntensity);
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
data.writeInt(torchIntensity);
remote.transact(10008, data, reply, 0);
reply.readException();
} finally {
data.recycle();
reply.recycle();
}
}
public void disconnectClients() throws CameraAccessException, RemoteException {
Log.e(TAG, "disconnectClients");
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
this.mRemote.transact(10009, data, reply, 0);
reply.readException();
} finally {
data.recycle();
reply.recycle();
}
}
public boolean isClientConnected() throws CameraAccessException, RemoteException {
Log.e(TAG, "isClientConnected");
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
this.mRemote.transact(10011, data, reply, 0);
reply.readException();
boolean isConnected = reply.readBoolean();
data.recycle();
reply.recycle();
Log.e(TAG, "isClientConnected: " + isConnected);
return isConnected;
} catch (Throwable th) {
data.recycle();
reply.recycle();
throw th;
}
}
public void closeAON() throws CameraAccessException, RemoteException {
Log.i(TAG, "closeAON E");
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
remote.transact(10013, data, reply, 0);
reply.readException();
} finally {
data.recycle();
reply.recycle();
}
}
public void setIsCameraUnitSession(boolean isCameraUnitSession) throws CameraAccessException, RemoteException {
Log.i(TAG, "setIsCameraUnitSession E");
IBinder remote = getCameraServiceRemote();
if (remote == null) {
throw new CameraAccessException(2, "Camera service is currently unavailable");
}
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
data.writeBoolean(isCameraUnitSession);
remote.transact(10016, data, reply, 0);
reply.readException();
} finally {
data.recycle();
reply.recycle();
}
}
@Override // android.os.IBinder.DeathRecipient
public void binderDied() {
mRemote = null;
this.mRemote = null;
}
}
}