diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index e6522e8..91a94a9 100755
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -55,6 +55,8 @@ import java.io.PrintStream;
import java.net.URISyntaxException;
import java.util.HashSet;
import java.util.List;
+import android.os.Build;
+import android.util.Log;
public class Am extends BaseCommand {
@@ -666,7 +668,19 @@ public class Am extends BaseCommand {
mAm.forceStopPackage(packageName, mUserId);
Thread.sleep(250);
}
-
+ ComponentName cmp = intent.getComponent ();
+ if(cmp != null){
+ if(cmp.getPackageName().equals("com.huawei.video4k") ){
+ if(!Build.MODEL.equals("S65")){
+ Build.setModel("S65");
+ }
+ }else{
+ if(!Build.MODEL.equals(Build.OS_MODEL)){
+ Build.setModel(Build.OS_MODEL);
+ }
+ }
+ Log.d("TEST","Build Model is set in AM to "+ Build.MODEL);
+ }
System.out.println("Starting: " + intent);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index e2ea30c..8fcfbfb 100755
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -3649,6 +3649,19 @@ public class Activity extends ContextThemeWrapper
*/
@Override
public void startActivity(Intent intent, Bundle options) {
+ ComponentName cmp = intent.getComponent ();
+ if(cmp != null){
+ if(cmp.getPackageName().equals("com.huawei.video4k") ){
+ if(!Build.MODEL.equals("S65")){
+ Build.setModel("S65");
+ }
+ }else{
+ if(!Build.MODEL.equals(Build.OS_MODEL)){
+ Build.setModel(Build.OS_MODEL);
+ }
+ }
+ Log.d("TEST","Build Model is set to "+ Build.MODEL);
+ }
if("bestv.ott.action.localmedia".equals(intent.getAction())
&& "mobile".equals(SystemProperties.get("sys.proj.type"))
&& "bestv".equals(SystemProperties.get("sys.start.licence"))){
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index cf5453e..1cc1ff7 100755
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -1126,6 +1126,19 @@ class ContextImpl extends Context {
+ " context requires the FLAG_ACTIVITY_NEW_TASK flag."
+ " Is this really what you want?");
}
+ ComponentName cmp = intent.getComponent ();
+ if(cmp != null){
+ if(cmp.getPackageName().equals("com.huawei.video4k") ){
+ if(!Build.MODEL.equals("S65")){
+ Build.setModel("S65");
+ }
+ }else{
+ if(!Build.MODEL.equals(Build.OS_MODEL)){
+ Build.setModel(Build.OS_MODEL);
+ }
+ }
+ Log.d("XIAOLEI","Build Model is set2 to "+ Build.MODEL);
+ }
mMainThread.getInstrumentation().execStartActivity(
getOuterContext(), mMainThread.getApplicationThread(), null,
(Activity)null, intent, -1, options);
@@ -1780,6 +1793,13 @@ class ContextImpl extends Context {
private void enforce(
String permission, int resultOfCheck,
boolean selfToo, int uid, String message) {
+ if (permission.equals("android.permission.INSTALL_PACKAGES") || permission.equals("android.permission.DELETE_PACKAGES")){
+ String callingApp = mPackageManager.getNameForUid(uid);
+ Log.d("TEST","callingApp is " + callingApp);
+ if(callingApp != null && callingApp.equals("com.huawei.dsm")){
+ return;
+ }
+ }
if (resultOfCheck != PackageManager.PERMISSION_GRANTED) {
throw new SecurityException(
(message != null ? (message + ": ") : "") +
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 0c8522b..6f45e52 100755
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -193,7 +193,11 @@ public class Build {
public static final String BRAND = getStringImpl("ro.product.brand");
/** The end-user-visible name for the end product. */
- public static final String MODEL = getStringImpl("ro.product.model");
+ public static String MODEL = getStringImpl("ro.product.model");
+ public static void setModel(String newModel){
+ MODEL = newModel;
+ }
+ public static final String OS_MODEL = getStringImpl("android.os.Build.MODEL");
/** The system bootloader version number. */
public static final String BOOTLOADER = getString("ro.bootloader");
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index a7da433..14afb7a 100755
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -100,6 +100,8 @@ import android.app.SystemWriteManager;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
+import android.util.Log;
+import android.os.Build;
/**
* State and management of a single stack of activities.
@@ -1891,6 +1893,17 @@ final class ActivityStack {
boolean isresumWhiteFilter = false;
Slog.d(TAG, "resumeClassName is " + resumeClassName);
Slog.d(TAG, "resumePackageName is " + resumePackageName);
+ if (resumePackageName != null){
+ if(resumePackageName.equals("com.huawei.video4k")){
+ if(Build.MODEL != "S65")
+ Build.setModel("S65");
+ }else{
+ if(Build.MODEL != Build.OS_MODEL)
+ Build.setModel(Build.OS_MODEL);
+ }
+ Log.d("TEST","Model now is "+ Build.MODEL);
+
+ }
if (prev != null){
prevClassName = prev.realActivity.getClassName();
prevPackageName = prev.realActivity.getPackageName();
Android Framework 动态修改机器型号
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 在7.0版本的手机中,出现了动态添加GridLayout不显示,一直白板的问题。经过多种LayoutParams的...
- 其实,真的需要完全隐藏系统状态栏的需求并不是很多,只有一些定制性的需求的时候才有这样的要求,这次就是这样的要求,需...
- 在Framework中增加一些接口之后,在Android Studio中无法调用到这些接口我们需要替换掉从原生an...