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();