diff --git a/oplus-fwk/src/android/app/OplusActivityManager.java b/oplus-fwk/src/android/app/OplusActivityManager.java new file mode 100644 index 0000000..3d51afc --- /dev/null +++ b/oplus-fwk/src/android/app/OplusActivityManager.java @@ -0,0 +1,25 @@ +package android.app; + +import android.os.RemoteException; + +import com.oplus.app.OplusAppInfo; + +import java.util.ArrayList; +import java.util.List; + +public class OplusActivityManager { + + private static OplusActivityManager sOplusActivityManager = null; + private static ArrayList sTopAppInfos = new ArrayList(); + + public static OplusActivityManager getInstance() { + if (sOplusActivityManager == null) { + sOplusActivityManager = new OplusActivityManager(); + } + return sOplusActivityManager; + } + + public List getAllTopAppInfos() throws RemoteException { + return (ArrayList) sTopAppInfos.clone(); + } +} diff --git a/oplus-fwk/src/android/app/OplusWhiteListManager.java b/oplus-fwk/src/android/app/OplusWhiteListManager.java new file mode 100644 index 0000000..6c6d1e5 --- /dev/null +++ b/oplus-fwk/src/android/app/OplusWhiteListManager.java @@ -0,0 +1,18 @@ +package android.app; + +import android.content.Context; + +import java.util.ArrayList; + +public class OplusWhiteListManager { + + public OplusWhiteListManager(Context context) {} + + public ArrayList getStageProtectListFromPkg(String calledPkg, int type) { + return new ArrayList<>(); + } + + public void addStageProtectInfo(String pkg, long timeout) {} + + public void removeStageProtectInfo(String pkg) {} +} diff --git a/oplus-fwk/src/android/app/job/IJobInfoExt.java b/oplus-fwk/src/android/app/job/IJobInfoExt.java new file mode 100644 index 0000000..d8b96e9 --- /dev/null +++ b/oplus-fwk/src/android/app/job/IJobInfoExt.java @@ -0,0 +1,43 @@ +package android.app.job; + +public interface IJobInfoExt { + + public final class JobBuilderExt { + + public boolean mIsOplusJob; + + public JobBuilderExt setRequiresBattIdle(boolean requiresBattIdle, int extra) { + return this; + } + } + + default boolean getBooleanConstraint(String type, boolean defValue) { + return defValue; + } + + default String getStringConstraint(String type, String defValue) { + return defValue; + } + + default int getIntConstraint(String type, int defValue) { + return defValue; + } + + default long getLongConstraint(String type, long defValue) { + return defValue; + } + + default void setBooleanConstraint(String type, boolean value) {} + + default void setStringConstraint(String type, String value) {} + + default void setIntConstraint(String type, int value) {} + + default void setLongConstraint(JobInfo job, String type, long value) {} + + default void initJobInfo(Object in) {} + + default void initJobInfoPure(JobBuilderExt jobBuilderExt) {} + + default void writeToParcelJobInfo(Object out, int flags) {} +} diff --git a/oplus-fwk/src/android/view/OplusWindowManager.java b/oplus-fwk/src/android/view/OplusWindowManager.java new file mode 100644 index 0000000..d087364 --- /dev/null +++ b/oplus-fwk/src/android/view/OplusWindowManager.java @@ -0,0 +1,8 @@ +package android.view; + +public class OplusWindowManager { + + public OplusWindowManager() {} + + public void requestKeyguard(String command) {} +} diff --git a/oplus-fwk/src/com/oplus/app/OplusAppEnterInfo.java b/oplus-fwk/src/com/oplus/app/OplusAppEnterInfo.java new file mode 100644 index 0000000..b86bd9e --- /dev/null +++ b/oplus-fwk/src/com/oplus/app/OplusAppEnterInfo.java @@ -0,0 +1,6 @@ +package com.oplus.app; + +public class OplusAppEnterInfo { + + public OplusAppEnterInfo() {} +} diff --git a/oplus-fwk/src/com/oplus/app/OplusAppExitInfo.java b/oplus-fwk/src/com/oplus/app/OplusAppExitInfo.java new file mode 100644 index 0000000..7517a98 --- /dev/null +++ b/oplus-fwk/src/com/oplus/app/OplusAppExitInfo.java @@ -0,0 +1,6 @@ +package com.oplus.app; + +public class OplusAppExitInfo { + + public OplusAppExitInfo() {} +} diff --git a/oplus-fwk/src/com/oplus/app/OplusAppInfo.java b/oplus-fwk/src/com/oplus/app/OplusAppInfo.java new file mode 100644 index 0000000..e5f63af --- /dev/null +++ b/oplus-fwk/src/com/oplus/app/OplusAppInfo.java @@ -0,0 +1,6 @@ +package com.oplus.app; + +public class OplusAppInfo { + + public OplusAppInfo() {} +} diff --git a/oplus-fwk/src/com/oplus/app/OplusAppSwitchConfig.java b/oplus-fwk/src/com/oplus/app/OplusAppSwitchConfig.java new file mode 100644 index 0000000..c7b5da0 --- /dev/null +++ b/oplus-fwk/src/com/oplus/app/OplusAppSwitchConfig.java @@ -0,0 +1,8 @@ +package com.oplus.app; + +import java.util.List; + +public class OplusAppSwitchConfig { + + public void addAppConfig(int type, List list) {} +} diff --git a/oplus-fwk/src/com/oplus/app/OplusAppSwitchManager.java b/oplus-fwk/src/com/oplus/app/OplusAppSwitchManager.java new file mode 100644 index 0000000..b120b85 --- /dev/null +++ b/oplus-fwk/src/com/oplus/app/OplusAppSwitchManager.java @@ -0,0 +1,37 @@ +package com.oplus.app; + +import android.content.Context; + +public class OplusAppSwitchManager { + + private static OplusAppSwitchManager sOplusAppSwitchManager = null; + + public static int APP_SWITCH_VERSION = 1; + + public static OplusAppSwitchManager getInstance() { + if (sOplusAppSwitchManager == null) { + sOplusAppSwitchManager = new OplusAppSwitchManager(); + } + return sOplusAppSwitchManager; + } + + public boolean registerAppSwitchObserver(Context context, + OnAppSwitchObserver observer, OplusAppSwitchConfig config) { + return true; + } + + public boolean unregisterAppSwitchObserver(Context context, OnAppSwitchObserver observer) { + return true; + } + + public interface OnAppSwitchObserver { + + void onActivityEnter(OplusAppEnterInfo oplusAppEnterInfo); + + void onActivityExit(OplusAppExitInfo oplusAppExitInfo); + + void onAppEnter(OplusAppEnterInfo oplusAppEnterInfo); + + void onAppExit(OplusAppExitInfo oplusAppExitInfo); + } +} diff --git a/oplus-fwk/src/com/oplus/orms/OplusResourceManager.java b/oplus-fwk/src/com/oplus/orms/OplusResourceManager.java new file mode 100644 index 0000000..6c75b27 --- /dev/null +++ b/oplus-fwk/src/com/oplus/orms/OplusResourceManager.java @@ -0,0 +1,19 @@ +package com.oplus.orms; + +import com.oplus.orms.info.OrmsSaParam; + +public class OplusResourceManager { + + private static OplusResourceManager sOplusResourceManager = null; + + public static OplusResourceManager getInstance(Class clazz) { + if (sOplusResourceManager == null) { + sOplusResourceManager = new OplusResourceManager(); + } + return sOplusResourceManager; + } + + public long ormsSetSceneAction(OrmsSaParam ormsSaParam) { + return -1L; + } +} diff --git a/oplus-fwk/src/com/oplus/orms/info/OrmsSaParam.java b/oplus-fwk/src/com/oplus/orms/info/OrmsSaParam.java new file mode 100644 index 0000000..ade8296 --- /dev/null +++ b/oplus-fwk/src/com/oplus/orms/info/OrmsSaParam.java @@ -0,0 +1,8 @@ +package com.oplus.orms.info; + +public class OrmsSaParam { + + public OrmsSaParam() {} + + public OrmsSaParam(String scene, String action, int timeout) {} +} diff --git a/oplus-fwk/src/com/oplus/os/OplusBuild.java b/oplus-fwk/src/com/oplus/os/OplusBuild.java new file mode 100644 index 0000000..f2647ca --- /dev/null +++ b/oplus-fwk/src/com/oplus/os/OplusBuild.java @@ -0,0 +1,8 @@ +package com.oplus.os; + +public class OplusBuild { + + public static int getOplusOSVERSION() { + return 23; + } +} diff --git a/oplus-fwk/src/com/oplus/os/OplusUsbEnvironment.java b/oplus-fwk/src/com/oplus/os/OplusUsbEnvironment.java new file mode 100644 index 0000000..19ac5b4 --- /dev/null +++ b/oplus-fwk/src/com/oplus/os/OplusUsbEnvironment.java @@ -0,0 +1,105 @@ +package com.oplus.os; + +import android.content.Context; +import android.os.Environment; +import android.os.RemoteException; +import android.os.ServiceManager; +import android.os.UserHandle; +import android.os.storage.DiskInfo; +import android.os.storage.IStorageManager; +import android.os.storage.StorageManager; +import android.os.storage.VolumeInfo; +import android.util.Log; + +import java.util.ArrayList; +import java.util.List; + +public class OplusUsbEnvironment extends Environment { + + private static final String TAG = "OplusUsbEnvironment"; + private static final String DEFAULT_INTERNAL_PATH = "/storage/emulated/0"; + + private static IStorageManager sMountService = null; + private static Object sLock = new Object(); + private static String sExternalSdDir = null; + private static String sInternalSdDir = DEFAULT_INTERNAL_PATH; + private static ArrayList sOtgPathes = new ArrayList<>(); + + private static void update(Context context) { + if (sMountService == null) { + sMountService = IStorageManager.Stub.asInterface(ServiceManager.getService("mount")); + } + getVolumes(); + } + + public static String getExternalPath(Context context) { + String path; + synchronized (sLock) { + update(context); + path = sExternalSdDir; + } + return path; + } + + public static String getInternalPath(Context context) { + String path; + synchronized (sLock) { + update(context); + path = sInternalSdDir; + } + return path; + } + + public static List getOtgPath(Context context) { + synchronized (sLock) { + update(context); + if (sOtgPathes == null) { + return null; + } + return (ArrayList) sOtgPathes.clone(); + } + } + + public static void getVolumes() { + if (sMountService == null) { + Log.e(TAG, "getVolumes: sMountService is null!!!"); + return; + } + try { + final VolumeInfo[] vols = sMountService.getVolumes(0); + sExternalSdDir = null; + sOtgPathes.clear(); + for (VolumeInfo vol : vols) { + final String path = vol.path; + if (vol.type == 2) { + final int userId = UserHandle.myUserId(); + if (path != null) { + sInternalSdDir = path.concat("/").concat(Integer.toString(userId)); + } + } else { + final DiskInfo diskInfo = vol.getDisk(); + if (diskInfo != null) { + if (diskInfo.isSd() && path != null) { + sExternalSdDir = path; + } + if (diskInfo.isUsb() && path != null && !sOtgPathes.contains(path)) { + sOtgPathes.add(path); + } + } + } + } + } catch (RemoteException e) { + } + } + + public static boolean isVolumeMounted(Context context, String path) { + synchronized (sLock) { + update(context); + } + final StorageManager sm = (StorageManager) context.getSystemService("storage"); + if (path == null || sm == null) { + return false; + } + return "mounted".equals(sm.getVolumeState(path)); + } +} diff --git a/oplus-fwk/src/com/oplus/screenshot/OplusLongshotCustomController.java b/oplus-fwk/src/com/oplus/screenshot/OplusLongshotCustomController.java new file mode 100644 index 0000000..c42eb2e --- /dev/null +++ b/oplus-fwk/src/com/oplus/screenshot/OplusLongshotCustomController.java @@ -0,0 +1,6 @@ +package com.oplus.screenshot; + +public class OplusLongshotCustomController { + + public OplusLongshotCustomController(OplusLongshotViewBase view, String source) {} +} diff --git a/oplus-fwk/src/com/oplus/screenshot/OplusLongshotViewBase.java b/oplus-fwk/src/com/oplus/screenshot/OplusLongshotViewBase.java new file mode 100644 index 0000000..24c276c --- /dev/null +++ b/oplus-fwk/src/com/oplus/screenshot/OplusLongshotViewBase.java @@ -0,0 +1,20 @@ +package com.oplus.screenshot; + +import android.content.Context; + +public interface OplusLongshotViewBase { + + boolean canLongScroll(); + + int computeLongScrollExtent(); + + int computeLongScrollOffset(); + + int computeLongScrollRange(); + + boolean findViewsLongshotInfo(OplusLongshowViewInfo oplusLongshowViewInfo); + + Context getContext(); + + boolean isLongshotVisibleToUser(); +} diff --git a/oplus-fwk/src/com/oplus/screenshot/OplusLongshowViewInfo.java b/oplus-fwk/src/com/oplus/screenshot/OplusLongshowViewInfo.java new file mode 100644 index 0000000..4c83c66 --- /dev/null +++ b/oplus-fwk/src/com/oplus/screenshot/OplusLongshowViewInfo.java @@ -0,0 +1,6 @@ +package com.oplus.screenshot; + +public class OplusLongshowViewInfo { + + public OplusLongshowViewInfo() {} +} diff --git a/oplus-fwk/src/com/oplus/util/OplusChangeTextUtil.java b/oplus-fwk/src/com/oplus/util/OplusChangeTextUtil.java new file mode 100644 index 0000000..fe8872a --- /dev/null +++ b/oplus-fwk/src/com/oplus/util/OplusChangeTextUtil.java @@ -0,0 +1,52 @@ +package com.oplus.util; + +public class OplusChangeTextUtil { + + private static final String TAG = "OplusChangeTextUtil"; + + private static final float H1 = 0.9f; + private static final float H2 = 1.0f; + private static final float H3 = 1.1f; + private static final float H4 = 1.25f; + private static final float H5 = 1.45f; + private static final float H6 = 1.65f; + + public static final int G1 = 1; + public static final int G2 = 2; + public static final int G3 = 3; + public static final int G4 = 4; + public static final int G5 = 5; + public static final int G6 = 6; + + public static final float[] SCALE_LEVEL = {H1, H2, H3, H4, H5, H6}; + + public static float getSuitableFontSize(float textSize, float scale, int level) { + if (level < 2) { + return textSize; + } + if (level > SCALE_LEVEL.length) { + level = SCALE_LEVEL.length; + } + final float textSizeNoScale = textSize / scale; + switch (level) { + case G2: + if (scale < H3) { + return H2 * textSizeNoScale; + } + return H3 * textSizeNoScale; + case G3: + if (scale < H3) { + return H2 * textSizeNoScale; + } + if (scale < H5) { + return H3 * textSizeNoScale; + } + return H4 * textSizeNoScale; + default: + if (scale > SCALE_LEVEL[level - 1]) { + return SCALE_LEVEL[level - 1] * textSizeNoScale; + } + return textSizeNoScale * scale; + } + } +} diff --git a/oplus-fwk/src/com/oplus/util/OplusNetworkUtil.java b/oplus-fwk/src/com/oplus/util/OplusNetworkUtil.java new file mode 100644 index 0000000..cd2ef59 --- /dev/null +++ b/oplus-fwk/src/com/oplus/util/OplusNetworkUtil.java @@ -0,0 +1,40 @@ +package com.oplus.util; + +import android.content.Context; +import android.content.Intent; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.net.Uri; + +public class OplusNetworkUtil { + + private static final String DEFAULT_HTTP_URI = "http://connectivitycheck.gstatic.com/generate_204"; + + public static boolean isWifiConnected(Context context) { + final ConnectivityManager cm = context.getSystemService(ConnectivityManager.class); + if (cm != null) { + return cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() + == NetworkInfo.State.CONNECTED; + } + return false; + } + + public static boolean isMobileDataConnected(Context context) { + final ConnectivityManager cm = context.getSystemService(ConnectivityManager.class); + if (cm != null) { + return cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() + == NetworkInfo.State.CONNECTED; + } + return false; + } + + public static void onClickLoginBtn(Context context) { + final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(DEFAULT_HTTP_URI)); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); + context.startActivity(intent); + } + + public static int getErrorString(Context context, String url) { + return 1; + } +} diff --git a/oplus-fwk/src/com/oplus/zoomwindow/IOplusZoomWindowObserver.aidl b/oplus-fwk/src/com/oplus/zoomwindow/IOplusZoomWindowObserver.aidl new file mode 100644 index 0000000..660dd74 --- /dev/null +++ b/oplus-fwk/src/com/oplus/zoomwindow/IOplusZoomWindowObserver.aidl @@ -0,0 +1,11 @@ +package com.oplus.zoomwindow; + +import com.oplus.zoomwindow.OplusZoomWindowInfo; + +interface IOplusZoomWindowObserver { + + void onInputMethodChanged(boolean z); + void onZoomWindowDied(String str); + void onZoomWindowHide(inout OplusZoomWindowInfo oplusZoomWindowInfo); + void onZoomWindowShow(inout OplusZoomWindowInfo oplusZoomWindowInfo); +} diff --git a/oplus-fwk/src/com/oplus/zoomwindow/OplusZoomWindowInfo.aidl b/oplus-fwk/src/com/oplus/zoomwindow/OplusZoomWindowInfo.aidl new file mode 100644 index 0000000..077f18d --- /dev/null +++ b/oplus-fwk/src/com/oplus/zoomwindow/OplusZoomWindowInfo.aidl @@ -0,0 +1,3 @@ +package com.oplus.zoomwindow; + +parcelable OplusZoomWindowInfo; diff --git a/oplus-fwk/src/com/oplus/zoomwindow/OplusZoomWindowInfo.java b/oplus-fwk/src/com/oplus/zoomwindow/OplusZoomWindowInfo.java new file mode 100644 index 0000000..682a8b6 --- /dev/null +++ b/oplus-fwk/src/com/oplus/zoomwindow/OplusZoomWindowInfo.java @@ -0,0 +1,37 @@ +package com.oplus.zoomwindow; + +import android.os.Parcel; +import android.os.Parcelable; + +public class OplusZoomWindowInfo implements Parcelable { + + public static final Parcelable.Creator CREATOR = + new Parcelable.Creator() { + + @Override + public OplusZoomWindowInfo createFromParcel(Parcel source) { + return new OplusZoomWindowInfo(source); + } + + @Override + public OplusZoomWindowInfo[] newArray(int size) { + return new OplusZoomWindowInfo[size]; + } + }; + + public OplusZoomWindowInfo() {} + + public OplusZoomWindowInfo(Parcel in) {} + + public OplusZoomWindowInfo(OplusZoomWindowInfo in) {} + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) {} + + public void readFromParcel(Parcel in) {} +} diff --git a/oplus-fwk/src/com/oplus/zoomwindow/OplusZoomWindowManager.java b/oplus-fwk/src/com/oplus/zoomwindow/OplusZoomWindowManager.java new file mode 100644 index 0000000..6075256 --- /dev/null +++ b/oplus-fwk/src/com/oplus/zoomwindow/OplusZoomWindowManager.java @@ -0,0 +1,21 @@ +package com.oplus.zoomwindow; + +public class OplusZoomWindowManager { + + public static OplusZoomWindowManager sOplusZoomWindowManager = null; + + public static OplusZoomWindowManager getInstance() { + if (sOplusZoomWindowManager == null) { + sOplusZoomWindowManager = new OplusZoomWindowManager(); + } + return sOplusZoomWindowManager; + } + + public boolean registerZoomWindowObserver(IOplusZoomWindowObserver observer) { + return false; + } + + public boolean unregisterZoomWindowObserver(IOplusZoomWindowObserver observer) { + return false; + } +} diff --git a/oplus-fwk/src/net/oneplus/odm/OpDeviceManagerInjector.java b/oplus-fwk/src/net/oneplus/odm/OpDeviceManagerInjector.java new file mode 100644 index 0000000..b03a3a2 --- /dev/null +++ b/oplus-fwk/src/net/oneplus/odm/OpDeviceManagerInjector.java @@ -0,0 +1,19 @@ +package net.oneplus.odm; + +import android.content.Context; + +import java.util.Map; + +public class OpDeviceManagerInjector { + + private static OpDeviceManagerInjector sOpDeviceManagerInjector = null; + + public void preserveAppData(Context a, String b, Map c, Map d) {} + + public static OpDeviceManagerInjector getInstance() { + if (sOpDeviceManagerInjector == null) { + sOpDeviceManagerInjector = new OpDeviceManagerInjector(); + } + return sOpDeviceManagerInjector; + } +} diff --git a/sepolicy/qti/private/property_contexts b/sepolicy/qti/private/property_contexts index 3e91d4f..78955cf 100644 --- a/sepolicy/qti/private/property_contexts +++ b/sepolicy/qti/private/property_contexts @@ -10,14 +10,12 @@ persist.sys.oplus.autotest. u:object_r:exported_system_prop:s0 persist.sys.bt.a2dp.pendingtime u:object_r:exported_system_prop:s0 # Camera - NA u:object_r:exported_system_prop:s0 -cam.algo. u:object_r:exported_system_prop:s0 -com.oplus.camera. u:object_r:exported_system_prop:s0 +cam.algo. u:object_r:exported_system_prop:s0 +com.oplus.camera. u:object_r:exported_system_prop:s0 oplus.camera. u:object_r:exported_system_prop:s0 oppo.camera. u:object_r:exported_system_prop:s0 persist.camera. u:object_r:exported_system_prop:s0 -persist.camera. u:object_r:exported_system_prop:s0 persist.sys.camera.lao.enable u:object_r:exported_system_prop:s0 persist.vendor.aps.debug.framenum u:object_r:exported_system_prop:s0 persist.vendor.apsSN.algo.enable u:object_r:exported_system_prop:s0