├── app ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── drawable │ │ │ ├── loading.png │ │ │ ├── loading_dialog.xml │ │ │ ├── change_color_btn.xml │ │ │ ├── change_color_close_btn.xml │ │ │ ├── change_color_unreg_btn.xml │ │ │ ├── button_press.xml │ │ │ ├── button_nopress.xml │ │ │ ├── close_button_nopress.xml │ │ │ ├── unreg_button_nopress.xml │ │ │ └── edittext.xml │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ ├── dimens.xml │ │ │ ├── colors.xml │ │ │ ├── styles.xml │ │ │ └── strings.xml │ │ └── layout │ │ │ ├── activity_main.xml │ │ │ ├── dialog_loading.xml │ │ │ └── fragment_home_info.xml │ │ ├── java │ │ └── com │ │ │ └── huawei │ │ │ ├── hms5gkit │ │ │ ├── activitys │ │ │ │ ├── IHmsKitActivity.java │ │ │ │ ├── base │ │ │ │ │ ├── BaseViewInterface.java │ │ │ │ │ ├── ActivityStack.java │ │ │ │ │ ├── PermissionBaseActivity.java │ │ │ │ │ └── BaseActivity.java │ │ │ │ ├── common │ │ │ │ │ ├── LoadingDialog.java │ │ │ │ │ ├── LoadingDialogCenter.java │ │ │ │ │ └── TranJson.java │ │ │ │ ├── constants │ │ │ │ │ ├── EventParamEnum.java │ │ │ │ │ └── QueryParamsEnum.java │ │ │ │ └── impl │ │ │ │ │ ├── HmsKitBaseActivity.java │ │ │ │ │ └── HmsKitActivity.java │ │ │ ├── utils │ │ │ │ ├── ToastUtil.java │ │ │ │ ├── TimeStampUtils.java │ │ │ │ └── ConnectHmsKitUtils.java │ │ │ └── presenter │ │ │ │ └── HmsKitPresenter.java │ │ │ ├── MyApplication.java │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml ├── build.gradle └── proguard-rules.pro ├── settings.gradle ├── images └── result.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── Third Party Open Source Notice.doc ├── gradle.properties ├── .gitignore ├── gradlew.bat ├── gradlew ├── README_ZH.md ├── README.md └── LICENSE /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /images/result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HMS-Core/hms-5g-modem-demo/HEAD/images/result.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HMS-Core/hms-5g-modem-demo/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Third Party Open Source Notice.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HMS-Core/hms-5g-modem-demo/HEAD/Third Party Open Source Notice.doc -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HMS-Core/hms-5g-modem-demo/HEAD/app/src/main/res/drawable/loading.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HMS-Core/hms-5g-modem-demo/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HMS-Core/hms-5g-modem-demo/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HMS-Core/hms-5g-modem-demo/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HMS-Core/hms-5g-modem-demo/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HMS-Core/hms-5g-modem-demo/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/change_color_btn.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/hms5gkit/activitys/IHmsKitActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei.hms5gkit.activitys; 6 | 7 | public interface IHmsKitActivity { 8 | void showQueryResult(); 9 | 10 | void showUnRegisterResult(); 11 | 12 | void showDataResult(String result); 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/change_color_close_btn.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/change_color_unreg_btn.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/hms5gkit/utils/ToastUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei.hms5gkit.utils; 6 | 7 | import android.widget.Toast; 8 | 9 | import com.huawei.MyApplication; 10 | 11 | public class ToastUtil { 12 | public static void toast(String text) { 13 | Toast.makeText(MyApplication.getContext(), text, Toast.LENGTH_SHORT).show(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/hms5gkit/activitys/base/BaseViewInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei.hms5gkit.activitys.base; 6 | 7 | import android.os.Bundle; 8 | 9 | public interface BaseViewInterface { 10 | void init(Bundle savedInstanceState); 11 | void initView(); 12 | void initData(); 13 | void initNav(); 14 | void regReceiver(); 15 | void unRegReceiver(); 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/button_press.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/button_nopress.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/close_button_nopress.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/unreg_button_nopress.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/MyApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei; 6 | 7 | import android.app.Application; 8 | import android.content.Context; 9 | 10 | public class MyApplication extends Application { 11 | private static Context gHmsTestAppContext; 12 | 13 | @Override 14 | public void onCreate() { 15 | super.onCreate(); 16 | gHmsTestAppContext = getApplicationContext(); 17 | } 18 | 19 | public static Context getContext() { 20 | return gHmsTestAppContext; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/hms5gkit/utils/TimeStampUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei.hms5gkit.utils; 6 | 7 | import android.annotation.SuppressLint; 8 | 9 | import java.text.SimpleDateFormat; 10 | import java.util.Date; 11 | 12 | public class TimeStampUtils { 13 | private static final String FORMAT = "yyyy-MM-dd HH:mm:ss"; 14 | 15 | // get current time 16 | public static String getCurDateStr() { 17 | @SuppressLint("SimpleDateFormat") SimpleDateFormat df = new SimpleDateFormat(FORMAT); 18 | return df.format(new Date()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/edittext.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 13 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | #org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | android.enableJetifier=true 15 | android.useAndroidX=true 16 | org.gradle.jvmargs=-Xmx1536m 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | .idea/ 38 | 39 | # Keystore files 40 | *.jks 41 | 42 | # External native build folder generated in Android Studio 2.2 and later 43 | .externalNativeBuild 44 | 45 | # Google Services (e.g. APIs or Firebase) 46 | google-services.json 47 | 48 | # Freeline 49 | freeline.py 50 | freeline/ 51 | freeline_project_description.json 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/hms5gkit/activitys/base/ActivityStack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei.hms5gkit.activitys.base; 6 | 7 | import android.app.Activity; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | public class ActivityStack { 13 | private static final ActivityStack INSTANCE = new ActivityStack(); 14 | 15 | private List activities = new ArrayList<>(); 16 | 17 | public static ActivityStack getInstance() { 18 | return INSTANCE; 19 | } 20 | 21 | public void addActivity(Activity activity) { 22 | activities.add(activity); 23 | } 24 | 25 | public void finishActivity(Activity activity) { 26 | if (activity != null) { 27 | activities.remove(activity); 28 | activity.finish(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/MainActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei; 6 | 7 | import android.os.Handler; 8 | 9 | import com.huawei.hms5gkit.R; 10 | import com.huawei.hms5gkit.activitys.base.PermissionBaseActivity; 11 | import com.huawei.hms5gkit.activitys.impl.HmsKitActivity; 12 | 13 | public class MainActivity extends PermissionBaseActivity { 14 | @Override 15 | public void initView() { 16 | requestPermission(); 17 | } 18 | 19 | @Override 20 | protected int getLayoutId() { 21 | return R.layout.activity_main; 22 | } 23 | 24 | private void requestPermission() { 25 | int time = 500; // Set the waiting time in milliseconds 26 | verifyStoragePermissions(flag -> { 27 | Handler handler = new Handler(); 28 | // When the timer ends, jump to the HmsKitActivity 29 | handler.postDelayed(() -> gotoActivity(HmsKitActivity.class, true), time); 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/hms5gkit/activitys/common/LoadingDialog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei.hms5gkit.activitys.common; 6 | 7 | import android.app.Dialog; 8 | import android.content.Context; 9 | import android.widget.TextView; 10 | 11 | import com.huawei.hms5gkit.R; 12 | 13 | public class LoadingDialog extends Dialog { 14 | private TextView loadingTv; 15 | 16 | LoadingDialog(Context context) { 17 | super(context); 18 | 19 | setContentView(R.layout.dialog_loading); 20 | loadingTv = findViewById(R.id.loading_tv); 21 | setCanceledOnTouchOutside(false); 22 | } 23 | 24 | /** 25 | * Set different prompt messages for the loading progress dialog 26 | * 27 | * @param message Prompt information displayed to users 28 | * @return build Mode design, you can chain call 29 | */ 30 | public LoadingDialog setMessage(String message) { 31 | loadingTv.setText(message); 32 | return this; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #e1e1e1 7 | 8 | #ddd 9 | #FFFFFF 10 | #00FFFFFF 11 | #FF7F50 12 | #D2691E 13 | #FFFF00 14 | #606060 15 | #000000 16 | #f1f1f1 17 | #dddddd 18 | #FCFAF2 19 | #2EC4FF 20 | #5BB75B 21 | #F44336 22 | #cccccc 23 | #F49DB0A4 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/hms5gkit/activitys/common/LoadingDialogCenter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei.hms5gkit.activitys.common; 6 | 7 | import android.content.Context; 8 | 9 | public class LoadingDialogCenter { 10 | private static volatile LoadingDialogCenter sInstance = null; 11 | 12 | private LoadingDialog mLoadingDialog; 13 | 14 | public static LoadingDialogCenter getInstance() { 15 | if (sInstance == null) { 16 | synchronized (LoadingDialogCenter.class) { 17 | if (sInstance == null) { 18 | sInstance = new LoadingDialogCenter(); 19 | } 20 | } 21 | } 22 | return sInstance; 23 | } 24 | 25 | public void showLoadingDialog(Context context, String message) { 26 | dismissLoadingDialog(); 27 | 28 | mLoadingDialog = new LoadingDialog(context); 29 | mLoadingDialog.setMessage(message).show(); 30 | } 31 | 32 | public void dismissLoadingDialog() { 33 | if (mLoadingDialog != null) { 34 | mLoadingDialog.dismiss(); 35 | mLoadingDialog = null; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 22 | 23 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_loading.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 13 | 14 | 19 | 20 | 25 | 26 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 19 | 20 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 29 5 | buildToolsVersion '29.0.3' 6 | defaultConfig { 7 | applicationId "com.huawei.hms5gkit32" 8 | minSdkVersion 26 9 | targetSdkVersion 29 10 | versionCode 109 11 | versionName "1.0.9" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } } 14 | } 15 | 16 | buildTypes { 17 | release { 18 | shrinkResources true 19 | minifyEnabled true 20 | zipAlignEnabled true 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | debug { 24 | debuggable true 25 | jniDebuggable false 26 | renderscriptDebuggable false 27 | minifyEnabled false 28 | zipAlignEnabled true 29 | } 30 | } 31 | compileOptions { 32 | sourceCompatibility JavaVersion.VERSION_1_8 33 | targetCompatibility JavaVersion.VERSION_1_8 34 | } 35 | 36 | lintOptions { 37 | checkReleaseBuilds false 38 | abortOnError false 39 | } 40 | } 41 | 42 | dependencies { 43 | implementation 'androidx.appcompat:appcompat:1.3.1' 44 | implementation 'com.jakewharton:butterknife:10.2.0' 45 | annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0' 46 | 47 | implementation 'com.huawei.hms:hms5gmodem-crowdtesting:6.0.0.303' 48 | } 49 | 50 | android.applicationVariants.all { variant -> 51 | variant.outputs.all { // modify apk name 52 | outputFileName = "Hms5GKitDemo-V${android.defaultConfig.versionName}-${variant.name}.apk" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | # Specify the compression level of the code 23 | -optimizationpasses 5 24 | # The package name is not mixed case 25 | -dontusemixedcaseclassnames 26 | # Don't ignore non-public library classes 27 | -dontskipnonpubliclibraryclasses 28 | # Optimization Does not optimize input class files 29 | -dontoptimize 30 | # Pre-check 31 | -dontpreverify 32 | # Whether to log when obfuscated 33 | -verbose 34 | # Ignore the warning 35 | -ignorewarnings 36 | -keepattributes *Annotation*,InnerClasses 37 | -keepattributes Exceptions 38 | -keepattributes Signature 39 | -keepattributes SourceFile,LineNumberTable 40 | 41 | # Four major components, View system, etc. 42 | -keep public class * extends android.app.Activity 43 | -keep public class * extends android.app.Application 44 | -keep public class * extends android.app.Fragment 45 | -keep public class * extends android.support.multidex.MultiDexApplication 46 | -keep public class * extends android.app.Service 47 | -keep public class * extends android.content.BroadcastReceiver 48 | -keep public class * extends android.content.ContentProvider 49 | -keep public class * extends android.preference.Preference 50 | -keep public class * extends android.view.View 51 | -keep class android.support.** {*;} 52 | -keep public class * extends android.support.v4.** 53 | 54 | -keep class com.huawei.hms.**{*;} 55 | -keep class com.huawei.hms5gkit.**{*;} 56 | -keep class com.huawei.hianalytics.**{*;} -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/hms5gkit/activitys/constants/EventParamEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei.hms5gkit.activitys.constants; 6 | 7 | import com.huawei.hms5gkit.agentservice.constants.parameters.FailureEvent; 8 | import com.huawei.hms5gkit.R; 9 | 10 | import java.util.ArrayList; 11 | import java.util.Arrays; 12 | import java.util.List; 13 | import java.util.Map; 14 | import java.util.stream.Collectors; 15 | 16 | public enum EventParamEnum { 17 | //EVENT_TYPE_FAILUREEVENT(R.id.fe, FailureEvent.FAILUREEVENT), 18 | EVENT_TYPE_FAILUREEVENT_SCG(R.id.fe_scg, FailureEvent.FAILUREEVENT_SCG), 19 | EVENT_TYPE_FAILUREEVENT_RACH(R.id.fe_rach, FailureEvent.FAILUREEVENT_RACH), 20 | EVENT_TYPE_FAILUREEVENT_RADIOLINK(R.id.fe_rl, FailureEvent.FAILUREEVENT_RADIOLINK), 21 | EVENT_TYPE_FAILUREEVENT_HANDOVER(R.id.fe_ho, FailureEvent.FAILUREEVENT_HANDOVER); 22 | 23 | private int resourceId; // Checkbox resource id 24 | private String eventName; // Request parameter 25 | public static int eventNum = 4; 26 | 27 | private static Map resourceId2EventNameMap 28 | = Arrays.stream(EventParamEnum.values()) 29 | .collect(Collectors.toMap(EventParamEnum::getResourceId, EventParamEnum::getEventName)); 30 | 31 | EventParamEnum(int resourceId, String eventName) { 32 | this.resourceId = resourceId; 33 | this.eventName = eventName; 34 | } 35 | 36 | public static Map getResourceId2EventNameMap() { 37 | return resourceId2EventNameMap; 38 | } 39 | 40 | public static List hasAllEvent(List selected) 41 | { 42 | List tmp = new ArrayList<>(); 43 | if (selected.size() == eventNum && selected.contains(FailureEvent.FAILUREEVENT_SCG) 44 | && selected.contains(FailureEvent.FAILUREEVENT_RACH) 45 | && selected.contains(FailureEvent.FAILUREEVENT_RADIOLINK) 46 | && selected.contains(FailureEvent.FAILUREEVENT_HANDOVER)) { 47 | tmp.add(FailureEvent.FAILUREEVENT); 48 | return tmp; 49 | }else { 50 | return selected; 51 | } 52 | } 53 | 54 | private int getResourceId() { 55 | return resourceId; 56 | } 57 | 58 | private String getEventName() { 59 | return eventName; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 29 | 30 | 34 | 35 | 44 | 45 | 49 | 50 | 54 | 55 | 58 | 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/hms5gkit/activitys/base/PermissionBaseActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei.hms5gkit.activitys.base; 6 | 7 | import android.Manifest; 8 | import android.content.pm.PackageManager; 9 | import android.util.Log; 10 | 11 | import androidx.annotation.NonNull; 12 | import androidx.core.app.ActivityCompat; 13 | import androidx.core.content.ContextCompat; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | public class PermissionBaseActivity extends BaseActivity { 19 | private static final String TAG = "[5ghmskit] PermissionBaseActivity"; 20 | public static final int REQUEST_CODE = 1; 21 | 22 | private static final String[] PERMISSIONS_STORAGE = { 23 | Manifest.permission.INTERNET, 24 | Manifest.permission.ACCESS_NETWORK_STATE, 25 | Manifest.permission.ACCESS_WIFI_STATE, 26 | Manifest.permission.ACCESS_FINE_LOCATION 27 | }; 28 | 29 | private static List sPermissionList = new ArrayList<>(); 30 | private PermissionListener mlistener; 31 | 32 | public void verifyStoragePermissions(PermissionListener permissionListener) { 33 | mlistener = permissionListener; 34 | sPermissionList.clear(); 35 | for (String permission : PERMISSIONS_STORAGE) { 36 | if (ContextCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) { 37 | sPermissionList.add(permission); 38 | } 39 | } 40 | 41 | if (!sPermissionList.isEmpty()) { 42 | Log.d(TAG, "Obtain the corresponding permissions"); 43 | String[] permissions = sPermissionList.toArray(new String[0]); 44 | ActivityCompat.requestPermissions(this, permissions, REQUEST_CODE); 45 | } else { 46 | Log.d(TAG, "All authorized"); 47 | permissionListener.onGranted(true); 48 | } 49 | } 50 | 51 | @Override 52 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { 53 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); 54 | if (requestCode == 1) { 55 | if (grantResults.length <= 0) { 56 | return; 57 | } 58 | List deniedPermissions = new ArrayList<>(); 59 | for (int i = 0; i < grantResults.length; i++) { 60 | int grantResult = grantResults[i]; 61 | if (grantResult != PackageManager.PERMISSION_GRANTED) { 62 | String permission = permissions[i]; 63 | deniedPermissions.add(permission); 64 | break; 65 | } 66 | } 67 | 68 | if (deniedPermissions.isEmpty()) { 69 | mlistener.onGranted(true); 70 | } else { 71 | mlistener.onGranted(false); 72 | } 73 | } 74 | } 75 | 76 | public interface PermissionListener { 77 | void onGranted(boolean flag); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/hms5gkit/activitys/base/BaseActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei.hms5gkit.activitys.base; 6 | 7 | import android.content.Context; 8 | import android.content.Intent; 9 | import android.os.Bundle; 10 | import android.view.LayoutInflater; 11 | 12 | import androidx.annotation.Nullable; 13 | import androidx.appcompat.app.AppCompatActivity; 14 | 15 | import butterknife.ButterKnife; 16 | 17 | 18 | public class BaseActivity extends AppCompatActivity implements BaseViewInterface { 19 | protected LayoutInflater mInflater; 20 | protected Context mContext; 21 | protected Bundle mSavedInstanceState; 22 | 23 | @Override 24 | protected void onCreate(@Nullable Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | 27 | ActivityStack.getInstance().addActivity(this); 28 | 29 | if (getLayoutId() != 0) { 30 | setContentView(getLayoutId()); 31 | } 32 | 33 | mInflater = getLayoutInflater(); 34 | mContext = this; 35 | mSavedInstanceState = savedInstanceState; 36 | 37 | init(savedInstanceState); 38 | initView(); 39 | initData(); 40 | regReceiver(); 41 | initNav(); 42 | } 43 | 44 | @Override 45 | public void init(Bundle savedInstanceState) { 46 | ButterKnife.bind(this); 47 | } 48 | 49 | @Override 50 | public void initView() { 51 | } 52 | 53 | @Override 54 | public void initData() { 55 | 56 | } 57 | 58 | @Override 59 | public void regReceiver() { 60 | 61 | } 62 | 63 | @Override 64 | public void unRegReceiver() { 65 | 66 | } 67 | 68 | @Override 69 | public void initNav() { 70 | } 71 | 72 | @Override 73 | protected void onSaveInstanceState(Bundle outState) { 74 | super.onSaveInstanceState(outState); 75 | } 76 | 77 | @Override 78 | protected void onRestoreInstanceState(Bundle savedInstanceState) { 79 | super.onRestoreInstanceState(savedInstanceState); 80 | } 81 | 82 | /** 83 | * Open an activity by default, do not close the current activity 84 | * 85 | * @param clz clz 86 | */ 87 | public void gotoActivity(Class clz) { 88 | gotoActivity(clz, false, null); 89 | } 90 | 91 | public void gotoActivity(Class clz, boolean isCloseCurrentActivity) { 92 | gotoActivity(clz, isCloseCurrentActivity, null); 93 | } 94 | 95 | public void gotoActivity(Class clz, boolean isCloseCurrentActivity, Bundle ex) { 96 | Intent intent = new Intent(this, clz); 97 | if (ex != null) { 98 | intent.putExtras(ex); 99 | } 100 | startActivity(intent); 101 | if (isCloseCurrentActivity) { 102 | ActivityStack.getInstance().finishActivity(this); 103 | } 104 | } 105 | 106 | @Override 107 | protected void onDestroy() { 108 | ActivityStack.getInstance().finishActivity(this); 109 | unRegReceiver(); 110 | super.onDestroy(); 111 | } 112 | 113 | protected int getLayoutId() { 114 | return 0; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Hms5GKitDemo 3 | 4 | Hello blank fragmen1t 5 | 5GHmsKit TEST TOOL 6 | 5G KIT TEST 7 | 5G Hms Kit Test 8 | 9 | FAILUREEVENT 10 | FE.SCG 11 | FE.RACH 12 | FE.RL 13 | FE.HO 14 | 15 | LTE 16 | L.Arfcn 17 | L.PID 18 | L.DF 19 | L.Band 20 | L.Mimo 21 | L.DBW 22 | L.LMT 23 | L.TAC 24 | L.CID 25 | L.Mcc 26 | L.Mnc 27 | L.MCell 28 | L.M.CID 29 | L.M.Rsrp 30 | L.M.Rsrq 31 | L.M.Sinr 32 | L.Scell 33 | L.S.Arfcn 34 | L.S.PID 35 | L.S.DF 36 | L.S.Band 37 | L.S.Mimo 38 | L.S.DBW 39 | L.S.Rsrp 40 | L.S.Rsrq 41 | L.S.Sinr 42 | 43 | NR 44 | N.SPCInfo 45 | N.SP.Basic 46 | N.SP.Cfg 47 | N.SP.Meas 48 | N.SCInfo 49 | N.S.Basic 50 | N.S.Cfg 51 | N.S.SsbMeas 52 | 53 | BEARER 54 | B.DInfo 55 | B.D.RbId 56 | B.D.PVer 57 | B.D.BType 58 | B.D.DST 59 | 60 | NetDiagnosis 61 | ND.LTE 62 | ND.NR 63 | ND.L.RC 64 | ND.L.RI 65 | ND.L.PRC 66 | ND.L.PRI 67 | ND.L.AC 68 | ND.L.Ambrs 69 | ND.N.RC 70 | ND.N.RI 71 | ND.N.PRC 72 | ND.N.PRI 73 | ND.N.AC 74 | ND.N.Ambrs 75 | 76 | Modem.Slice 77 | 78 | REG 79 | QUERY 80 | UNREG 81 | ENABLE 82 | DISABLE 83 | 84 | -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/hms5gkit/activitys/common/TranJson.java: -------------------------------------------------------------------------------- 1 | package com.huawei.hms5gkit.activitys.common; 2 | 3 | import android.util.Log; 4 | 5 | import androidx.annotation.NonNull; 6 | 7 | import org.json.JSONException; 8 | import org.json.JSONObject; 9 | 10 | import java.text.SimpleDateFormat; 11 | import java.util.ArrayList; 12 | import java.util.Calendar; 13 | import java.util.Date; 14 | import java.util.Iterator; 15 | import java.util.List; 16 | 17 | public class TranJson 18 | { 19 | public static long maxTime = 4294967295L; 20 | private String ParamName; 21 | private String ModemSlice; 22 | private String JsonStr; 23 | private List JsonKeyValue; 24 | private List TimeStamp; 25 | 26 | public TranJson(){ 27 | JsonKeyValue = new ArrayList<>(); 28 | TimeStamp = new ArrayList<>(); 29 | } 30 | 31 | public void setParamAndJsonStr(String paramName,String jsonStr){ 32 | JsonStr = jsonStr; 33 | ParamName = paramName; 34 | } 35 | 36 | public String getParamName(){ return ParamName; } 37 | 38 | public void setModemSlice(String modemSlice) throws JSONException { 39 | try { 40 | JSONObject jsonObj = new JSONObject(modemSlice); 41 | ModemSlice = jsonObj.get("curTimeStamp").toString(); 42 | } catch (JSONException e) { 43 | e.printStackTrace(); 44 | ModemSlice = modemSlice.toString(); 45 | } 46 | } 47 | 48 | public void clean(){ 49 | ModemSlice = null; 50 | JsonStr = null; 51 | JsonKeyValue.clear(); 52 | TimeStamp.clear(); 53 | } 54 | 55 | public String TimeTran() throws JSONException { 56 | 57 | SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); 58 | Calendar c = Calendar.getInstance(); 59 | c.setTime(new Date()); 60 | 61 | if(JsonStr == "") //当Json字符串为空时,不进行转换 62 | { 63 | return ""; 64 | } 65 | iteraJson(JsonStr,JsonKeyValue); 66 | for (String jsonKeyValue : JsonKeyValue) { 67 | if(jsonKeyValue.contains("timestamp")){ 68 | TimeStamp.add(jsonKeyValue.split(":")[1]); //jsonKeyValue中数据形式为key:value,这里将data中的所有时间戳全部取出 69 | } 70 | } 71 | for (String timestamp : TimeStamp) 72 | { 73 | int sec; 74 | if(Long.parseLong(timestamp) > maxTime) { 75 | sec = (int)((Long.parseLong(timestamp)-Long.parseLong(ModemSlice)-maxTime)/32768L); 76 | }else { 77 | sec = (int)((Long.parseLong(timestamp)-Long.parseLong(ModemSlice))/32768L); 78 | } 79 | c.add(Calendar.SECOND, sec); 80 | Date d = c.getTime(); 81 | String day = format.format(d); 82 | JsonStr = JsonStr.replace(timestamp,day); 83 | } 84 | return JsonStr; 85 | } 86 | 87 | public static boolean iteraJson(String str, List res) throws JSONException { 88 | if(str.indexOf(":") == -1){ //Json字符串中没有":"证明无值,则不进行递归解析 89 | return true; 90 | } 91 | JSONObject Json = new JSONObject(str); 92 | Iterator keys = Json.keys(); 93 | while(keys.hasNext()){ 94 | String key = keys.next().toString(); 95 | Object value = Json.get(key); 96 | String val = value.toString(); 97 | if(val.indexOf("[{") == -1){ 98 | if(val.indexOf(":") == -1){ 99 | res.add(key+":"+val); 100 | }else{ 101 | iteraJson(val,res); 102 | } 103 | }else if(val.indexOf("[{") != -1){ 104 | if(val.indexOf("[{") == 0){ 105 | String jsons = val.substring(1, val.lastIndexOf("]"));//得到数据格式为:{...},{...},{...} 106 | jsons = jsons.replaceAll("\\}\\s?,\\s?\\{", "}~{"); 107 | String[] split = jsons.split("~"); 108 | for(int i = 0; i < split.length;i++){ 109 | iteraJson(split[i],res); 110 | } 111 | }else{ 112 | iteraJson(val,res);//value仍然可能是一个json且这个json中包含数组。 113 | } 114 | } 115 | } 116 | return false; 117 | } 118 | 119 | } 120 | 121 | -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/hms5gkit/presenter/HmsKitPresenter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei.hms5gkit.presenter; 6 | 7 | import android.content.Context; 8 | import android.util.Log; 9 | 10 | import com.huawei.hms5gkit.activitys.IHmsKitActivity; 11 | import com.huawei.hms5gkit.utils.ConnectHmsKitUtils; 12 | 13 | import java.lang.ref.WeakReference; 14 | import java.util.List; 15 | 16 | public class HmsKitPresenter { 17 | private static final String TAG = "[5ghmskit] HmsKitPresenter"; 18 | private static final long SLEEP_TIME = 100L; 19 | 20 | private ConnectHmsKitUtils mHmsKitUtils = ConnectHmsKitUtils.getInstance(); 21 | private WeakReference mHmsKitActivity; 22 | private Context mContext; 23 | 24 | public HmsKitPresenter(Context context, IHmsKitActivity hmsKitActivity) { 25 | mContext = context; 26 | mHmsKitActivity = new WeakReference<>(hmsKitActivity); 27 | ConnectHmsKitUtils.getInstance().setHmsKitActivity(hmsKitActivity); 28 | } 29 | 30 | public boolean getConnectStatus() { 31 | return mHmsKitUtils.getConnectStatus(); 32 | } 33 | 34 | // register 35 | public void registerCallback() { 36 | Log.i(TAG, "registerCallback"); 37 | boolean flag = mHmsKitUtils.registerCallback(mContext); 38 | if (flag) { 39 | Log.i(TAG, "registerCallback success"); 40 | } else { 41 | Log.i(TAG, "registerCallback failed"); 42 | } 43 | } 44 | 45 | public void unRegisterCallback() { 46 | Log.i(TAG, "unRegisterCallback"); 47 | mHmsKitUtils.unRegisterCallback(); 48 | if (mHmsKitActivity != null && mHmsKitActivity.get() != null) { 49 | mHmsKitActivity.get().showUnRegisterResult(); 50 | } 51 | } 52 | 53 | public void queryModem(List selected) { 54 | Log.i(TAG, "queryModem start"); 55 | new Thread(() -> { 56 | for (String queryItem : selected) { 57 | if (!mHmsKitUtils.queryModem(queryItem)) { 58 | Log.e(TAG, queryItem + " query modem failed."); 59 | } else { 60 | Log.i(TAG, queryItem + " query modem success."); 61 | } 62 | try { 63 | Thread.sleep(SLEEP_TIME); 64 | } catch (InterruptedException e) { 65 | e.printStackTrace(); 66 | } 67 | } 68 | if (mHmsKitActivity != null && mHmsKitActivity.get() != null) { 69 | mHmsKitActivity.get().showQueryResult(); 70 | } 71 | }).start(); 72 | } 73 | 74 | public void enable(List selected) { 75 | Log.i(TAG, "enableEvent start"); 76 | new Thread(() -> { 77 | for (String enableEventItem : selected) { 78 | if (!mHmsKitUtils.enable(enableEventItem)) { 79 | Log.e(TAG, enableEventItem + " event enable failed."); 80 | } else { 81 | Log.i(TAG, enableEventItem + " event enable success."); 82 | } 83 | try { 84 | Thread.sleep(SLEEP_TIME); 85 | } catch (InterruptedException e) { 86 | e.printStackTrace(); 87 | } 88 | } 89 | if (mHmsKitActivity != null && mHmsKitActivity.get() != null) { 90 | mHmsKitActivity.get().showQueryResult(); 91 | } 92 | }).start(); 93 | } 94 | 95 | public void disable(List selected) { 96 | Log.i(TAG, "disableEvent start"); 97 | new Thread(() -> { 98 | for (String disableEventItem : selected) { 99 | if (!mHmsKitUtils.disable(disableEventItem)) { 100 | Log.e(TAG, disableEventItem + " event disable failed."); 101 | } else { 102 | Log.i(TAG, disableEventItem + " event disable success."); 103 | } 104 | try { 105 | Thread.sleep(SLEEP_TIME); 106 | } catch (InterruptedException e) { 107 | e.printStackTrace(); 108 | } 109 | } 110 | if (mHmsKitActivity != null && mHmsKitActivity.get() != null) { 111 | mHmsKitActivity.get().showQueryResult(); 112 | } 113 | }).start(); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/hms5gkit/activitys/impl/HmsKitBaseActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei.hms5gkit.activitys.impl; 6 | 7 | import android.widget.CheckBox; 8 | 9 | import com.huawei.hms5gkit.R; 10 | import com.huawei.hms5gkit.activitys.base.BaseActivity; 11 | 12 | import butterknife.BindView; 13 | 14 | public abstract class HmsKitBaseActivity extends BaseActivity { 15 | @BindView(R.id.fe_scg) 16 | CheckBox feScgCbox; 17 | @BindView(R.id.fe_rach) 18 | CheckBox feRachCbox; 19 | @BindView(R.id.fe_rl) 20 | CheckBox feRadioLinkCbox; 21 | @BindView(R.id.fe_ho) 22 | CheckBox feHandOverCbox; 23 | 24 | @BindView(R.id.lte_cb) 25 | CheckBox lteCbox; 26 | @BindView(R.id.lte_arfcn_cb) 27 | CheckBox lteArfcnCbox; 28 | @BindView(R.id.lte_phyCellId_cb) 29 | CheckBox ltePhyCellIdCbox; 30 | @BindView(R.id.lte_dlFreq_cb) 31 | CheckBox lteDlFreqCbox; 32 | @BindView(R.id.lte_band) 33 | CheckBox lteBandCbox; 34 | @BindView(R.id.lte_mimo) 35 | CheckBox lteMimoCbox; 36 | @BindView(R.id.lte_dbw) 37 | CheckBox lteDlBandWidthCbox; 38 | @BindView(R.id.lte_lmt) 39 | CheckBox lteModeTypeCbox; 40 | @BindView(R.id.lte_tac) 41 | CheckBox lteTrackAreaCodeCbox; 42 | @BindView(R.id.lte_cid) 43 | CheckBox lteCellIdentityCbox; 44 | @BindView(R.id.lte_mcc) 45 | CheckBox lteMccCbox; 46 | @BindView(R.id.lte_mnc) 47 | CheckBox lteMncCbox; 48 | @BindView(R.id.lte_mcell) 49 | CheckBox lteMeasCellCbox; 50 | @BindView(R.id.lte_m_cid) 51 | CheckBox lteMeasCellCellIdCbox; 52 | @BindView(R.id.lte_m_rsrp) 53 | CheckBox lteMeasCellRsrpCbox; 54 | @BindView(R.id.lte_m_rsrq) 55 | CheckBox lteMeasCellRsrqCbox; 56 | @BindView(R.id.lte_m_sinr) 57 | CheckBox lteMeasCellSinrCbox; 58 | @BindView(R.id.lte_scell) 59 | CheckBox lteScellCbox; 60 | @BindView(R.id.lte_s_arfcn) 61 | CheckBox lteScellArfcnCbox; 62 | @BindView(R.id.lte_s_pid) 63 | CheckBox lteScellPhyCellIdCbox; 64 | @BindView(R.id.lte_s_df) 65 | CheckBox lteScellDlFreqCbox; 66 | @BindView(R.id.lte_s_band) 67 | CheckBox lteScellBandCbox; 68 | @BindView(R.id.lte_s_mimo) 69 | CheckBox lteScellMimoCbox; 70 | @BindView(R.id.lte_s_dbw) 71 | CheckBox lteScellDlBandWidthCbox; 72 | @BindView(R.id.lte_s_rsrp) 73 | CheckBox lteScellRsrpCbox; 74 | @BindView(R.id.lte_s_rsrq) 75 | CheckBox lteScellRsrqCbox; 76 | @BindView(R.id.lte_s_sinr) 77 | CheckBox lteScellSinrCbox; 78 | 79 | @BindView(R.id.nr) 80 | CheckBox nrCbox; 81 | @BindView(R.id.n_scinfo) 82 | CheckBox nrServCellInfoCbox; 83 | @BindView(R.id.n_sc_basic) 84 | CheckBox nrServCellInfoBasicCbox; 85 | @BindView(R.id.n_sc_cfg) 86 | CheckBox nrServCellInfoCfgInfoCbox; 87 | @BindView(R.id.n_sc_ssbmeasinfo) 88 | CheckBox nrServCellInfoSsbMeasCbox; 89 | @BindView(R.id.n_spcinfo) 90 | CheckBox nrSPCellInfoCbox; 91 | @BindView(R.id.n_sp_basic) 92 | CheckBox nrSPCellInfoBasicCbox; 93 | @BindView(R.id.n_sp_cfg) 94 | CheckBox nrSPCellInfoCfgInfoCbox; 95 | @BindView(R.id.n_sp_meas) 96 | CheckBox nrSPCellInfoMeasCbox; 97 | 98 | @BindView(R.id.bearer_cb) 99 | CheckBox bearerCbox; 100 | @BindView(R.id.bearer_dinfo) 101 | CheckBox bearerDrbInfoCbox; 102 | @BindView(R.id.bearer_d_rbid) 103 | CheckBox bearerDrbInfoRbIdCbox; 104 | @BindView(R.id.bearer_d_pver) 105 | CheckBox bearerDrbInfoPdcpVersionCbox; 106 | @BindView(R.id.bearer_d_btype) 107 | CheckBox bearerDrbInfoBearerTypeCbox; 108 | @BindView(R.id.bearer_d_dst) 109 | CheckBox bearerDrbInfoDataSplitThresholdCbox; 110 | 111 | @BindView(R.id.nd) 112 | CheckBox ndTypeCbox; 113 | @BindView(R.id.nd_lteinfo) 114 | CheckBox ndLteInfoCbox; 115 | @BindView(R.id.nd_nrinfo) 116 | CheckBox ndNrInfoCbox; 117 | @BindView(R.id.nd_l_rejcnt) 118 | CheckBox ndLteRejCntCbox; 119 | @BindView(R.id.nd_l_rejinfos) 120 | CheckBox ndLteRejInfosCbox; 121 | @BindView(R.id.nd_l_pdnrejcnt) 122 | CheckBox ndLtePdnRejcntCbox; 123 | @BindView(R.id.nd_l_pdnrejinfos) 124 | CheckBox ndLtePdnRejInfosCbox; 125 | @BindView(R.id.nd_l_ambrcnt) 126 | CheckBox ndLteAmbrCntCbox; 127 | @BindView(R.id.nd_l_ambrs) 128 | CheckBox ndLteAmbrsCbox; 129 | @BindView(R.id.nd_n_rejcnt) 130 | CheckBox ndNrRejCntCbox; 131 | @BindView(R.id.nd_n_rejinfo) 132 | CheckBox ndNrRejInfosCbox; 133 | @BindView(R.id.nd_n_pdurejcnt) 134 | CheckBox ndNrPduRejCntCbox; 135 | @BindView(R.id.nd_n_pdurejinfo) 136 | CheckBox ndNrPduRejInfoCbox; 137 | @BindView(R.id.nd_n_ambrcnt) 138 | CheckBox ndNrAmbrCntCbox; 139 | @BindView(R.id.nd_n_ambrs) 140 | CheckBox ndNrAmbrCbox; 141 | 142 | @BindView(R.id.modem_slice) 143 | CheckBox modemsliceCbox; 144 | } 145 | -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/hms5gkit/activitys/constants/QueryParamsEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei.hms5gkit.activitys.constants; 6 | 7 | import com.huawei.hms5gkit.agentservice.constants.ModemType; 8 | import com.huawei.hms5gkit.agentservice.constants.parameters.Bearer; 9 | import com.huawei.hms5gkit.agentservice.constants.parameters.Lte; 10 | import com.huawei.hms5gkit.agentservice.constants.parameters.ModemSlice; 11 | import com.huawei.hms5gkit.agentservice.constants.parameters.NetDiagnosis; 12 | import com.huawei.hms5gkit.agentservice.constants.parameters.Nr; 13 | import com.huawei.hms5gkit.R; 14 | 15 | import java.util.Arrays; 16 | import java.util.Map; 17 | import java.util.stream.Collectors; 18 | 19 | public enum QueryParamsEnum { 20 | LTE_TYPE(R.id.lte_cb, Lte.LTE), 21 | LTE_TYPE_ARFCN(R.id.lte_arfcn_cb, Lte.LTE_ARFCN), 22 | LTE_TYPE_PHYCELLID(R.id.lte_phyCellId_cb, Lte.LTE_PHYCELLID), 23 | LTE_TYPE_DLFREQ(R.id.lte_dlFreq_cb, Lte.LTE_DLFREQ), 24 | LTE_TYPE_BAND(R.id.lte_band, Lte.LTE_BAND), 25 | LTE_TYPE_MIMO(R.id.lte_mimo, Lte.LTE_MIMO), 26 | LTE_TYPE_DLBANDWIDTH(R.id.lte_dbw, Lte.LTE_DL_BANDWIDTH), 27 | LTE_TYPE_LTEMODETYPE(R.id.lte_lmt, Lte.LTE_LTE_MODE_TYPE), 28 | LTE_TYPE_TRACKAREACODE(R.id.lte_tac, Lte.LTE_TRACK_AREA_CODE), 29 | LTE_TYPE_CELLIDENTITY(R.id.lte_cid, Lte.LTE_CELL_IDENTITY), 30 | LTE_TYPE_MCC(R.id.lte_mcc, Lte.LTE_MCC), 31 | LTE_TYPE_MNC(R.id.lte_mnc, Lte.LTE_MNC), 32 | LTE_TYPE_MEASCELL(R.id.lte_mcell, Lte.LTE_INTRA_EUTRA_CELL_MEAS_INFO), 33 | LTE_TYPE_MEASCELL_CELLID(R.id.lte_m_cid, Lte.LTE_INTRA_EUTRA_CELL_MEAS_INFO_CELLID), 34 | LTE_TYPE_MEASCELL_RSRP(R.id.lte_m_rsrp, Lte.LTE_INTRA_EUTRA_CELL_MEAS_INFO_RSRP), 35 | LTE_TYPE_MEASCELL_RSRQ(R.id.lte_m_rsrq, Lte.LTE_INTRA_EUTRA_CELL_MEAS_INFO_RSRQ), 36 | LTE_TYPE_MEASCELL_SINR(R.id.lte_m_sinr, Lte.LTE_INTRA_EUTRA_CELL_MEAS_INFO_SINR), 37 | LTE_TYPE_SCELL(R.id.lte_scell, Lte.LTE_SCELL), 38 | LTE_TYPE_SCELL_ARFCN(R.id.lte_s_arfcn, Lte.LTE_SCELL_arfcn), 39 | LTE_TYPE_SCELL_PHYCELLID(R.id.lte_s_pid, Lte.LTE_SCELL_phyCellId), 40 | LTE_TYPE_SCELL_DLFREQ(R.id.lte_s_df, Lte.LTE_SCELL_dlFreq), 41 | LTE_TYPE_SCELL_BAND(R.id.lte_s_band, Lte.LTE_SCELL_band), 42 | LTE_TYPE_SCELL_MIMO(R.id.lte_s_mimo, Lte.LTE_SCELL_mimo), 43 | LTE_TYPE_SCELL_DLBANDWIDTH(R.id.lte_s_dbw, Lte.LTE_SCELL_dlBandWidth), 44 | LTE_TYPE_SCELL_RSRP(R.id.lte_s_rsrp, Lte.LTE_SCELL_rsrp), 45 | LTE_TYPE_SCELL_RSRQ(R.id.lte_s_rsrq, Lte.LTE_SCELL_rsrq), 46 | LTE_TYPE_SCELL_SINR(R.id.lte_s_sinr, Lte.LTE_SCELL_sinr), 47 | 48 | NR_TYPE(R.id.nr, Nr.NR), 49 | NR_TYPE_SERVPRIMARYCELLINFO(R.id.n_spcinfo, Nr.NR_SPCELL_INFO), 50 | NR_TYPE_SERVCELLINFO(R.id.n_scinfo, Nr.NR_SCELL_INFO), 51 | NR_TYPE_SERVPRIMARYCELLINFO_BASIC(R.id.n_sp_basic, Nr.NR_SPCELL_BASIC), 52 | NR_TYPE_SERVPRIMARYCELLINFO_CFG(R.id.n_sp_cfg, Nr.NR_SPCELL_CFG), 53 | NR_TYPE_SERVPRIMARYCELLINFO_MEAS(R.id.n_sp_meas, Nr.NR_SPCELL_MEAS), 54 | NR_TYPE_SERVCELLINFO_BASIC(R.id.n_sc_basic, Nr.NR_SCELL_BASIC), 55 | NR_TYPE_SERVCELLINFO_CFG(R.id.n_sc_cfg, Nr.NR_SCELL_CFG), 56 | NR_TYPE_SERVCELLINFO_SSB_MEAS(R.id.n_sc_ssbmeasinfo, Nr.NR_SCELL_SSB_MEAS), 57 | 58 | 59 | BEARER_TYPE(R.id.bearer_cb, Bearer.BEARER), 60 | BEARER_TYPE_DRBINFO(R.id.bearer_dinfo, Bearer.BEARER_DRB_INFO), 61 | BEARER_TYPE_DRBINFO_RBID(R.id.bearer_d_rbid, Bearer.BEARER_RBID), 62 | BEARER_TYPE_DRBINFO_PDCPVERSION(R.id.bearer_d_pver, Bearer.BEARER_PDCP_VERSION), 63 | BEARER_TYPE_DRBINFO_BEARERTYPE(R.id.bearer_d_btype, Bearer.BEARER_BEARER_TYPE), 64 | BEARER_TYPE_DRBINFO_DATASPLITTHRESHOLD(R.id.bearer_d_dst, Bearer.BEARER_DATA_SPLIT_THRESHOLD), 65 | 66 | NET_TYPE_INFO(R.id.nd, NetDiagnosis.NET), 67 | NET_TYPE_LTE_INFO(R.id.nd_lteinfo,NetDiagnosis.NET_LTE_INFO), 68 | NET_TYPE_NR_INFO(R.id.nd_nrinfo,NetDiagnosis.NET_NR_INFO), 69 | NET_TYPE_LTE_REJ_CNT(R.id.nd_l_rejcnt,NetDiagnosis.NET_LTE_REJ_CNT), 70 | NET_TYPE_LTE_REJ_INFOS(R.id.nd_l_rejinfos,NetDiagnosis.NET_LTE_REJ_INFOS), 71 | NET_TYPE_LTE_PDN_REJ_CNT(R.id.nd_l_pdnrejcnt,NetDiagnosis.NET_LTE_PDN_REJ_CNT), 72 | NET_TYPE_LTE_PDN_REJ_INFOS(R.id.nd_l_pdnrejinfos,NetDiagnosis.NET_LTE_PDN_REJ_INFOS), 73 | NET_TYPE_LTE_AMBR_CNT(R.id.nd_l_ambrcnt,NetDiagnosis.NET_LTE_AMBR_CNT), 74 | NET_TYPE_LTE_AMBRS(R.id.nd_l_ambrs,NetDiagnosis.NET_LTE_AMBRS), 75 | NET_TYPE_NR_REJ_CNT(R.id.nd_n_rejcnt,NetDiagnosis.NET_NR_REJ_CNT), 76 | NET_TYPE_NR_REJ_INFO(R.id.nd_n_rejinfo,NetDiagnosis.NET_NR_REJ_INFO), 77 | NET_TYPE_NR_PDU_REJ_CNT(R.id.nd_n_pdurejcnt,NetDiagnosis.NET_NR_PDU_REJ_CNT), 78 | NET_TYPE_NR_PDU_REJ_INFO(R.id.nd_n_pdurejinfo,NetDiagnosis.NET_NR_PDU_REJ_INFO), 79 | NET_TYPE_NR_AMBR_CNT(R.id.nd_n_ambrcnt,NetDiagnosis.NET_NR_AMBR_CNT), 80 | NET_TYPE_NR_AMBR(R.id.nd_n_ambrs,NetDiagnosis.NET_NR_AMBR), 81 | 82 | MODEM_SLICE(R.id.modem_slice, ModemSlice.MODEM_SLICE); 83 | 84 | 85 | private int resourceId; // Checkbox resource id 86 | private String queryName; // Request parameter 87 | 88 | private static Map resourceId2QueryNameMap 89 | = Arrays.stream(QueryParamsEnum.values()) 90 | .collect(Collectors.toMap(QueryParamsEnum::getResourceId, QueryParamsEnum::getQueryName)); 91 | 92 | QueryParamsEnum(int resourceId, String queryName) { 93 | this.resourceId = resourceId; 94 | this.queryName = queryName; 95 | } 96 | 97 | public static Map getResourceId2QueryNameMap() { 98 | return resourceId2QueryNameMap; 99 | } 100 | 101 | private int getResourceId() { 102 | return resourceId; 103 | } 104 | 105 | private String getQueryName() { 106 | return queryName; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/hms5gkit/utils/ConnectHmsKitUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei.hms5gkit.utils; 6 | 7 | import android.content.Context; 8 | import android.util.Log; 9 | 10 | import com.huawei.MainActivity; 11 | import com.huawei.hms5gkit.activitys.IHmsKitActivity; 12 | import com.huawei.hms5gkit.activitys.common.TranJson; 13 | import com.huawei.hms5gkit.agentservice.constants.parameters.Bearer; 14 | import com.huawei.hms5gkit.agentservice.constants.parameters.Lte; 15 | import com.huawei.hms5gkit.agentservice.constants.parameters.ModemSlice; 16 | import com.huawei.hms5gkit.agentservice.constants.parameters.Nr; 17 | import com.huawei.hms5gkit.agentservice.constants.parameters.NetDiagnosis; 18 | import com.huawei.hms5gkit.agentservice.controller.IConnectProcess; 19 | import com.huawei.hms5gkit.agentservice.controller.IQueryModem; 20 | import com.huawei.hms5gkit.agentservice.controller.IResProcess; 21 | import com.huawei.hms5gkit.agentservice.controller.impl.QueryModemController; 22 | 23 | import org.json.JSONException; 24 | 25 | import java.util.ArrayList; 26 | import java.util.Arrays; 27 | 28 | public class ConnectHmsKitUtils { 29 | private static final String TAG = "[5ghmskit] ConnectHmsKitUtils"; 30 | 31 | private ConnectHmsKitUtils() { 32 | } 33 | 34 | private IHmsKitActivity mHmsKitActivity; 35 | 36 | public void setHmsKitActivity(IHmsKitActivity hmsKitActivity) { 37 | mHmsKitActivity = hmsKitActivity; 38 | } 39 | 40 | private volatile static ConnectHmsKitUtils connectHmsKitUtils; 41 | 42 | public static ConnectHmsKitUtils getInstance() { 43 | if (connectHmsKitUtils == null) { 44 | synchronized (ConnectHmsKitUtils.class) { 45 | if (connectHmsKitUtils == null) { 46 | connectHmsKitUtils = new ConnectHmsKitUtils(); 47 | } 48 | } 49 | } 50 | return connectHmsKitUtils; 51 | } 52 | 53 | public TranJson tranJson = new TranJson(); 54 | 55 | private IResProcess mResProcess = response -> { 56 | if (response != null && response.getCode() == 0) { 57 | String key = response.getQueryParameters(); 58 | String data = response.getValue(); 59 | String content = TimeStampUtils.getCurDateStr() + " "; 60 | if (data != null) { 61 | if(key.equals(NetDiagnosis.NET) || key.equals(NetDiagnosis.NET_LTE_INFO) || key.equals(NetDiagnosis.NET_NR_INFO) || 62 | key.equals(NetDiagnosis.NET_LTE_REJ_CNT) || key.equals(NetDiagnosis.NET_LTE_REJ_INFOS ) || key.equals(NetDiagnosis.NET_LTE_PDN_REJ_CNT) || 63 | key.equals(NetDiagnosis.NET_LTE_PDN_REJ_INFOS) || key.equals(NetDiagnosis.NET_NR_REJ_CNT) || key.equals(NetDiagnosis.NET_NR_REJ_INFO) || 64 | key.equals(NetDiagnosis.NET_NR_PDU_REJ_CNT) || key.equals(NetDiagnosis.NET_NR_PDU_REJ_INFO) 65 | ){ //需要转换时间戳的消息 66 | tranJson.setParamAndJsonStr(key,data); 67 | queryModem(ModemSlice.MODEM_SLICE_CURTIMESTAMP); 68 | }else if(key.equals(ModemSlice.MODEM_SLICE_CURTIMESTAMP)){ 69 | try { 70 | tranJson.setModemSlice(data); 71 | String tmp = tranJson.TimeTran(); 72 | content += tranJson.getParamName() + " test request result: \"" + tmp + "\""; 73 | Log.i(TAG, content); 74 | mHmsKitActivity.showDataResult(content); 75 | tranJson.clean(); 76 | } catch (JSONException e) { 77 | e.printStackTrace(); 78 | Log.i(TAG, content); 79 | mHmsKitActivity.showDataResult(content + "ModemSlice时间戳解析失败:" + e.toString()); 80 | } 81 | } 82 | else{ 83 | content += key + " request result: \"" + data + "\""; 84 | Log.i(TAG, content); 85 | mHmsKitActivity.showDataResult(content); 86 | } 87 | } else { 88 | content += key + " request result is null"; 89 | Log.i(TAG, content); 90 | mHmsKitActivity.showDataResult(content); 91 | 92 | } 93 | 94 | } 95 | else if (response != null && response.getCode() == 200) { //约定周期上报响应码为200 96 | String data = response.getValue(); 97 | String content = TimeStampUtils.getCurDateStr() + " "; 98 | if (data != null) { 99 | content += " NR failure event result: \"" + data + "\""; 100 | } else { 101 | content += " NR failure event result is null"; 102 | } 103 | Log.i(TAG, content); 104 | mHmsKitActivity.showDataResult(content); 105 | }else { 106 | if (response != null) { 107 | String content = TimeStampUtils.getCurDateStr() + " error code: " 108 | + response.getCode() + ",\t" + response.getMsg(); 109 | Log.e(TAG, content); 110 | mHmsKitActivity.showDataResult(content); 111 | } else { 112 | Log.e(TAG, "response is null"); 113 | } 114 | } 115 | }; 116 | 117 | private IConnectProcess mConnectProcess = response -> { 118 | if (response == null) { 119 | Log.e(TAG, "ConnectProcess callback response data is null"); 120 | return; 121 | } 122 | String content; 123 | if (response.getCode() != 0) { 124 | content = TimeStampUtils.getCurDateStr() + " connect error code: " + response.getCode() + 125 | ", error msg: " + response.getMsg(); 126 | Log.e(TAG, content); 127 | } else { 128 | content = TimeStampUtils.getCurDateStr() + " connect code: " + response.getCode() + 129 | ", msg: " + response.getMsg(); 130 | Log.i(TAG, content); 131 | } 132 | mHmsKitActivity.showDataResult(content); 133 | }; 134 | 135 | private IQueryModem mQueryModem = QueryModemController.getInstance(); 136 | 137 | public boolean registerCallback(Context context) { 138 | return mQueryModem.registerCallback(context, mResProcess, mConnectProcess); 139 | } 140 | 141 | public boolean getConnectStatus() { 142 | return mQueryModem.getAidlConnectStatus(); 143 | } 144 | 145 | public boolean queryModem(String requestName) { 146 | // For input parameters, please refer to the Lte, Nr and Bearer classes 147 | // under the com.huawei.hms5gkit.agentservice.constants.parameters package in 5G Kit SDK 148 | // Lte 149 | // Nr 150 | // Bearer 151 | return mQueryModem.queryModem(requestName); 152 | } 153 | 154 | public void unRegisterCallback() { 155 | mQueryModem.unRegisterCallback(); 156 | } 157 | 158 | public boolean disable(String category) { return mQueryModem.disable(category);} 159 | 160 | public boolean enable(String category) { return mQueryModem.enable(category);} 161 | } 162 | -------------------------------------------------------------------------------- /README_ZH.md: -------------------------------------------------------------------------------- 1 | # 华为5G Modem Kit Sample 2 | 3 | 中文 | [English](README.md) 4 | 5 | ## 目录 6 | 7 | * [简介](#简介) 8 | * [开发准备](#开发准备) 9 | * [环境要求](#环境要求) 10 | * [运行结果](#运行结果) 11 | * [技术支持](#技术支持) 12 | * [授权许可](#授权许可) 13 | 14 | 15 | ## 简介 16 | 17 | 本示例代码封装5G Modem Kit SDK服务的安卓接口,通过该示例代码,您将体验到如何使用5G Modem Kit相关接口查询Modem参数信息。 18 | 19 | ## 开发准备 20 | 21 | 1. 检查Android Studio开发环境是否准备就绪。 22 | 2. 打开示例项目,在您的安卓设备上运行示例代码。 23 | 24 | ## 环境要求 25 | 26 | 1. 推荐Android SDK版本号为28或以上,JDK版本号为1.8或以上。 27 | 2. 该版本使用了Java 8的新特性:如Lambda 表达式等。Gradle需要添加Java 8编译配置如下: 28 | 29 | ``` 30 | compileOptions { 31 | sourceCompatibility JavaVersion.VERSION_1_8 32 | targetCompatibility JavaVersion.VERSION_1_8 33 | } 34 | ``` 35 | 36 | 37 | 38 | ## 运行结果 39 | 40 | 41 | 42 | 其中上图复选框部分为Modem参数的简称,详情请参见如下表格,其中**description**部分描述了该Modem参数请求信息。 43 | 44 | | 简称 | modem参数 | description | 45 | | --------- | ------------------------------------------------------------ | ---------------------------- | 46 | | LTE | LTE = "LTE" | LTE所有信息 | 47 | | L.Arfcn | LTE_ARFCN = "LTE.arfcn" | LTE小区频点 | 48 | | L.PID | LTE_PHYCELLID = "LTE.phyCellId" | LTE物理小区ID | 49 | | L.DF | LTE_DLFREQ = "LTE.dlFreq" | LTE下行物理频率 | 50 | | L.Band | LTE_BAND = "LTE.band" | LTE频带指示 | 51 | | L.Mimo | LTE_MIMO = "LTE.mimo" | LTE小区的MIMO层数 | 52 | | L.DBW | LTE_DL_BANDWIDTH = "LTE.dlBandWidth" | LTE小区带宽 | 53 | | L.LMT | LTE_LTE_MODE_TYPE = "LTE.lteModeType" | LTE小区模式类型 | 54 | | L.TAC | LTE_TRACK_AREA_CODE = "LTE.trackAreaCode" | TAC信息 | 55 | | L.CID | LTE_CELL_IDENTITY = "LTE.cellIdentity" | 全球小区ID | 56 | | L.Mcc | LTE_MCC = "LTE.mcc" | 移动国家码MCC | 57 | | L.Mnc | LTE_MNC = "LTE.mnc" | 移动网络码MNC | 58 | | L.MCell | LTE_INTRA_EUTRA_CELL_MEAS_INFO = "LTE.measCell" | LTE主小区测量结果全部信息 | 59 | | L.M.CID | LTE_INTRA_EUTRA_CELL_MEAS_INFO_CELLID = "LTE.measCell_cellId" | LTE主小区物理小区ID | 60 | | L.M.Rsrp | LTE_INTRA_EUTRA_CELL_MEAS_INFO_RSRP = "LTE.measCell_rsrp" | LTE主小区RSRP测量值 | 61 | | L.M.Rsrq | LTE_INTRA_EUTRA_CELL_MEAS_INFO_RSRQ = "LTE.measCell_rsrq" | LTE主小区RSRQ测量值 | 62 | | L.M.Sinr | LTE_INTRA_EUTRA_CELL_MEAS_INFO_SINR = "LTE.measCell_sinr" | LTE主小区SINR测量值 | 63 | | L.Scell | LTE_SCELL = "LTE.scell" | LTE辅小区信息全部信息 | 64 | | L.S.Arfcn | LTE_SCELL_arfcn = "LTE.scell_arfcn" | LTE辅小区频点 | 65 | | L.S.PID | LTE_SCELL_phyCellId = "LTE.scell_phyCellId" | LTE辅小区物理小区ID | 66 | | L.S.DF | LTE_SCELL_dlFreq = "LTE.scell_dlFreq" | LTE辅小区下行物理频率 | 67 | | L.S.Band | LTE_SCELL_band = "LTE.scell_band" | LTE辅小区频带指示 | 68 | | L.S.Mimo | LTE_SCELL_mimo = "LTE.scell_mimo" | LTE辅小区mimo层数 | 69 | | L.S.DBW | LTE_SCELL_dlBandWidth = "LTE.scell_dlBandWidth" | LTE辅小区带宽 | 70 | | L.S.Rsrp | LTE_SCELL_rsrp = "LTE.scell_rsrp" | LTE辅小区RSRP测量值 | 71 | | L.S.Rsrq | LTE_SCELL_rsrq = "LTE.scell_rsrq" | LTE辅小区RSRQ测量值 | 72 | | L.S.Sinr | LTE_SCELL_sinr = "LTE.scell_sinr" | LTE辅小区SINR测量值 | 73 | | NR | NR = "NR" | 所有NR信息 | 74 | | N.SPCInfo | NR_SPCELL_INFO = "NR.spCellInfo" | NR SpCell信息 | 75 | | N.SP.Basic| NR_SPCELL_BASIC = "NR.spCellInfo_basicInfo" | NR SpCell的基本信息 | 76 | | N.SP.Cfg | NR_SPCELL_CFG = "NR.spCellInfo_cfgInfo" | NR SpCell的配置信息 | 77 | | N.SP.Meas | NR_SPCELL_MEAS = "NR.spCellInfo_measInfo " | NR SpCell的测量信息 | 78 | | N.SCInfo | NR_SCELL_INFO = "NR.sCellInfo" | NR辅小区信息 | 79 | | N.S.Basic | NR_SCELL_BASIC = "NR.sCellInfo_basicInfo" | NR辅小区的基本信息 | 80 | | N.S.Cfg | NR_SCELL_CFG = "NR.sCellInfo_cfgInfo" | NR辅小区的配置信息 | 81 | | N.S.SsbMeas | NR_SCELL_SSB_MEAS = "NR. sCellInfo_ssbMeasInfo " | NR辅小区的测量信息 | 82 | | NetDiagnosis| NET = "NETDIAGNOSIS" | 网络诊断信息 | 83 | | ND.LTE | NET_LTE_INFO = "NETDIAGNOSIS.lteInfo" | LTE网络的诊断信息 | 84 | | ND.NR | NET_NR_INFO = "NETDIAGNOSIS.nrInfo" | NR网络的诊断信息 | 85 | | ND.L.RC | NET_LTE_REJ_CNT = "NETDIAGNOSIS.lteInfo_rejCnt" | LTE注册被拒次数 | 86 | | ND.L.RI | NET_LTE_REJ_INFOS = "NETDIAGNOSIS.lteInfo_rejInfos" | LTE注册被拒详细信息 | 87 | | ND.L.PRC | NET_LTE_PDN_REJ_CNT = "NETDIAGNOSIS.lteInfo_pdnRejCnt" | LTE建立pdn被拒次数 | 88 | | ND.L.PRI | NET_LTE_PDN_REJ_INFOS = "NETDIAGNOSIS.lteInfo_pdnRejInfos" | LTE建立pdn被拒信息 | 89 | | ND.L.AC | NET_LTE_AMBR_CNT = "NETDIAGNOSIS.lteInfo_ambrCnt" | LTE PDU承载AMBR个数 | 90 | | ND.L.Ambrs | NET_LTE_AMBRS = "NETDIAGNOSIS.lteInfo_ambrs" | 缺省承载对应的Ambr信息 | 91 | | ND.N.RC | NET_NR_REJ_CNT = "NETDIAGNOSIS.nrInfo_rejCnt" | NR注册被拒次数 | 92 | | ND.N.RI | NET_NR_REJ_INFO = "NETDIAGNOSIS.nrInfo_rejInfos" | NR注册被拒详细信息 | 93 | | ND.N.PRC | NET_NR_PDU_REJ_CNT = "NETDIAGNOSIS.nrInfo_pduRejCnt" | PDU session建立被拒次数 | 94 | | ND.N.PRI | NET_NR_PDU_REJ_INFO = "NETDIAGNOSIS. nrInfo_pduRejInfo" | PDU session建立被拒信息 | 95 | | ND.N.AC | NET_NR_AMBR_CNT = "NETDIAGNOSIS.nrInfo_ambrCnt" | pdu session AMBR信息个数 | 96 | | ND.N.Ambrs | NET_NR_AMBR = "NETDIAGNOSIS. nrInfo_ambr" | NR SESSION-AMBR信息 | 97 | | FE.SCG | NET_NR_PDU_REJ_CNT = "NETDIAGNOSIS.nrInfo_pduRejCnt" | SCG FAILURE流程异常主动上报开关 | 98 | | FE.RACH | NET_NR_PDU_REJ_INFO = "NETDIAGNOSIS. nrInfo_pduRejInfo" | RACH FAILURE流程异常主动上报开关 | 99 | | FE.RL | NET_NR_AMBR_CNT = "NETDIAGNOSIS.nrInfo_ambrCnt" | RADIOLINK FAILURE流程异常主动上报开关 | 100 | | FE.HO | NET_NR_AMBR = "NETDIAGNOSIS. nrInfo_ambr" | HANDOVER FAILURE流程异常主动上报开关 | 101 | | Modem.Slice | NET_NR_AMBR = "NETDIAGNOSIS. nrInfo_ambr" | modem系统时间戳信息 | 102 | | BEARER | BEARER = "BEARER" | 所有BEARER信息 | 103 | | B.DInfo | BEARER_DRB_INFO = "BEARER.drbInfo" | 所有drb信息 | 104 | | B.D.RbId | BEARER_RBID = "BEARER.drbInfo_rbId" | DRB ID | 105 | | B.D.PVer | BEARER_PDCP_VERSION = "BEARER.drbInfo_pdcpVersion" | PDCP Version | 106 | | B.D.BType | BEARER_BEARER_TYPE = "BEARER.drbInfo_bearerType" | bearer类型 | 107 | | B.D.DST | BEARER_DATA_SPLIT_THRESHOLD = "BEARER.drbInfo_dataSplitThreshold" | UE上行数据分裂阈值 | 108 | 109 | ## 技术支持 110 | 111 | 如果您对HMS Core还处于评估阶段,可在[Reddit社区](https://www.reddit.com/r/HuaweiDevelopers/)获取关于HMS Core的最新讯息,并与其他开发者交流见解。 112 | 113 | 如果您对使用HMS示例代码有疑问,请尝试: 114 | 115 | - 开发过程遇到问题上[Stack Overflow](https://stackoverflow.com/questions/tagged/huawei-mobile-services?tab=Votes),在\[huawei-mobile-services]标签下提问,有华为研发专家在线一对一解决您的问题。 116 | - 到[华为开发者论坛](https://developer.huawei.com/consumer/cn/forum/blockdisplay?fid=18?ha_source=hms1) HMS Core板块与其他开发者进行交流。 117 | 118 | 如果您在尝试示例代码中遇到问题,请向仓库提交[issue](),也欢迎您提交[Pull Request]()。 119 | 120 | ## 授权许可 121 | 122 | 5G Kit示例代码经过[Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0)授权许可。 -------------------------------------------------------------------------------- /app/src/main/java/com/huawei/hms5gkit/activitys/impl/HmsKitActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved. 3 | */ 4 | 5 | package com.huawei.hms5gkit.activitys.impl; 6 | 7 | import android.annotation.SuppressLint; 8 | import android.content.Context; 9 | import android.os.Bundle; 10 | import android.text.method.ScrollingMovementMethod; 11 | import android.util.Log; 12 | import android.widget.Button; 13 | import android.widget.CheckBox; 14 | import android.widget.CompoundButton; 15 | import android.widget.TextView; 16 | 17 | import androidx.fragment.app.Fragment; 18 | 19 | import com.huawei.MyApplication; 20 | import com.huawei.hms5gkit.R; 21 | import com.huawei.hms5gkit.activitys.IHmsKitActivity; 22 | import com.huawei.hms5gkit.activitys.common.LoadingDialogCenter; 23 | import com.huawei.hms5gkit.activitys.constants.EventParamEnum; 24 | import com.huawei.hms5gkit.activitys.constants.QueryParamsEnum; 25 | import com.huawei.hms5gkit.presenter.HmsKitPresenter; 26 | import com.huawei.hms5gkit.utils.TimeStampUtils; 27 | import com.huawei.hms5gkit.utils.ToastUtil; 28 | 29 | import java.util.ArrayList; 30 | import java.util.Arrays; 31 | import java.util.List; 32 | import java.util.concurrent.CopyOnWriteArrayList; 33 | 34 | import butterknife.BindView; 35 | import butterknife.ButterKnife; 36 | 37 | /** 38 | * A simple {@link Fragment} subclass. 39 | */ 40 | public class HmsKitActivity extends HmsKitBaseActivity implements IHmsKitActivity { 41 | private static final String TAG = "[5ghmskit] HmsKitActivity"; 42 | public static final int TEXT_LENGTH = 2048; 43 | 44 | // Collection object used to store selected items 45 | // After query, all selected will not be cancelled 46 | List selectedparam = new CopyOnWriteArrayList<>(); 47 | List selectedevent = new CopyOnWriteArrayList<>(); 48 | 49 | @BindView(R.id.registerBtn) 50 | Button regBtn; 51 | 52 | @BindView(R.id.queryBtn) 53 | Button queryBtn; 54 | 55 | @BindView(R.id.unRegister) 56 | Button unRegisterBtn; 57 | 58 | @BindView(R.id.enableEvent) 59 | Button enableEventBtn; 60 | 61 | @BindView(R.id.disableEvent) 62 | Button disableEventBtn; 63 | 64 | @BindView(R.id.textOutput) 65 | TextView outputText; 66 | 67 | private HmsKitPresenter mHmsKitPresenter; 68 | List mCheckBoxList; 69 | List mParamCheckBoxList; 70 | List mEventCheckBoxList; 71 | 72 | @Override 73 | protected int getLayoutId() { 74 | return R.layout.fragment_home_info; 75 | } 76 | 77 | @Override 78 | public void init(Bundle savedInstanceState) { 79 | super.init(savedInstanceState); 80 | ButterKnife.bind(this); 81 | Context context = getApplicationContext(); 82 | mHmsKitPresenter = new HmsKitPresenter(context, this); 83 | } 84 | 85 | @Override 86 | public void initView() { 87 | super.initView(); 88 | regBtn.setOnClickListener(view -> mHmsKitPresenter.registerCallback()); 89 | queryBtn.setOnClickListener(view -> { 90 | if (!mHmsKitPresenter.getConnectStatus()) { 91 | hasNotRegister(); 92 | return; 93 | } 94 | if (selectedparam.size() == 0) { 95 | ToastUtil.toast("No Data Selected"); 96 | return; 97 | } 98 | LoadingDialogCenter.getInstance().showLoadingDialog(this, "Querying..."); 99 | mHmsKitPresenter.queryModem(selectedparam); 100 | // String p = ""; 101 | // for(String e: selectedparam) { 102 | // p = p + e + ","; 103 | // } 104 | // ToastUtil.toast("点击query:" + p); 105 | }); 106 | unRegisterBtn.setOnClickListener(view -> mHmsKitPresenter.unRegisterCallback()); 107 | enableEventBtn.setOnClickListener(view ->{ 108 | if (!mHmsKitPresenter.getConnectStatus()) { 109 | hasNotRegister(); 110 | return; 111 | } 112 | if (selectedevent.size() == 0) { 113 | ToastUtil.toast("No Data Selected"); 114 | return; 115 | } 116 | LoadingDialogCenter.getInstance().showLoadingDialog(this, "Enabling Event..."); 117 | mHmsKitPresenter.enable(EventParamEnum.hasAllEvent(selectedevent)); 118 | // String p = ""; 119 | // for(String e: selectedevent) { //EventParamEnum.hasAllEvent(selectedevent) 120 | // p = p + e + ","; 121 | // } 122 | // ToastUtil.toast("点击enable:" + p); 123 | }); 124 | disableEventBtn.setOnClickListener(view ->{ 125 | if (!mHmsKitPresenter.getConnectStatus()) { 126 | hasNotRegister(); 127 | return; 128 | } 129 | if (selectedevent.size() == 0) { 130 | ToastUtil.toast("No Data Selected"); 131 | return; 132 | } 133 | LoadingDialogCenter.getInstance().showLoadingDialog(this, "Disabling Event..."); 134 | mHmsKitPresenter.disable(EventParamEnum.hasAllEvent(selectedevent)); 135 | // String p = ""; 136 | // for(String e: EventParamEnum.hasAllEvent(selectedevent)) { //EventParamEnum.hasAllEvent(selectedevent) 137 | // p = p + e + ","; 138 | // } 139 | // ToastUtil.toast("点击disable:" + p); 140 | }); 141 | initParamCheckBoxes(); 142 | initEventCheckBoxes(); 143 | outputText.setMovementMethod(ScrollingMovementMethod.getInstance()); 144 | } 145 | 146 | @Override 147 | public void showQueryResult() { 148 | LoadingDialogCenter.getInstance().dismissLoadingDialog(); 149 | } 150 | 151 | @Override 152 | public void showUnRegisterResult() { 153 | cancelAll(); 154 | } 155 | 156 | @SuppressLint("SetTextI18n") 157 | @Override 158 | public void showDataResult(String result) { 159 | if (outputText != null) { 160 | runOnUiThread(() -> { 161 | String output = outputText.getText().toString(); 162 | if (output.length() > TEXT_LENGTH) { 163 | output = ""; 164 | } 165 | outputText.setText(result + System.lineSeparator() + System.lineSeparator() + output); 166 | }); 167 | } 168 | } 169 | 170 | private CompoundButton.OnCheckedChangeListener mChangeListener = (buttonView, isChecked) -> { 171 | int resourceId = buttonView.getId(); 172 | String selectParamStr = QueryParamsEnum.getResourceId2QueryNameMap().getOrDefault(resourceId, ""); 173 | String selectEventStr = EventParamEnum.getResourceId2EventNameMap().getOrDefault(resourceId, ""); 174 | if (isChecked) { 175 | // Save a Map (key: resourceId, value: queryName), 176 | // Add the selected text to the list, 177 | if (!"".equals(selectParamStr)) { 178 | selectedparam.add(selectParamStr); 179 | }else if (!"".equals(selectEventStr)) 180 | { 181 | selectedevent.add(selectEventStr); 182 | } 183 | setTextChocolate(buttonView); 184 | } else { 185 | // The text to be canceled is deleted from the selected list 186 | if (!"".equals(selectParamStr)) { 187 | selectedparam.remove(selectParamStr); 188 | }else if (!"".equals(selectEventStr)) 189 | { 190 | selectedevent.remove(selectEventStr); 191 | } 192 | setTextBlack(buttonView); 193 | } 194 | }; 195 | 196 | private void hasNotRegister() { 197 | String content = TimeStampUtils.getCurDateStr() + " aidl has not register"; 198 | showDataResult(content); 199 | Log.i(TAG, content); 200 | } 201 | 202 | private void initParamCheckBoxes() { 203 | CheckBox[] checkBoxes = new CheckBox[]{ 204 | lteCbox, lteArfcnCbox, ltePhyCellIdCbox, lteDlFreqCbox, lteBandCbox, 205 | lteMimoCbox, lteDlBandWidthCbox, lteModeTypeCbox, lteTrackAreaCodeCbox, 206 | lteCellIdentityCbox, lteMccCbox, lteMncCbox, lteMeasCellCbox, lteMeasCellCellIdCbox, 207 | lteMeasCellRsrpCbox, lteMeasCellRsrqCbox, lteMeasCellSinrCbox, lteScellCbox, 208 | lteScellArfcnCbox, lteScellPhyCellIdCbox, lteScellDlFreqCbox, lteScellBandCbox, 209 | lteScellMimoCbox, lteScellDlBandWidthCbox, lteScellRsrpCbox, lteScellRsrqCbox, 210 | lteScellSinrCbox, 211 | nrCbox, nrServCellInfoCbox, nrServCellInfoBasicCbox, 212 | nrServCellInfoCfgInfoCbox, nrServCellInfoSsbMeasCbox, nrSPCellInfoCbox, nrSPCellInfoBasicCbox, 213 | nrSPCellInfoCfgInfoCbox, nrSPCellInfoMeasCbox, 214 | bearerCbox, bearerDrbInfoCbox, bearerDrbInfoRbIdCbox, 215 | bearerDrbInfoPdcpVersionCbox, bearerDrbInfoBearerTypeCbox, 216 | bearerDrbInfoDataSplitThresholdCbox, 217 | ndTypeCbox, ndLteInfoCbox, ndNrInfoCbox, 218 | ndLteRejCntCbox, ndLteRejInfosCbox, ndLtePdnRejcntCbox, 219 | ndLtePdnRejInfosCbox, ndLteAmbrCntCbox, ndLteAmbrsCbox, ndNrRejCntCbox, 220 | ndNrRejInfosCbox, ndNrPduRejCntCbox, ndNrPduRejInfoCbox, 221 | ndNrAmbrCntCbox,ndNrAmbrCbox, 222 | modemsliceCbox 223 | }; 224 | mParamCheckBoxList = new ArrayList<>(Arrays.asList(checkBoxes)); 225 | for (CheckBox checkBox : mParamCheckBoxList) { 226 | checkBox.setOnCheckedChangeListener(mChangeListener); 227 | } 228 | } 229 | 230 | private void initEventCheckBoxes() { 231 | CheckBox[] checkBoxes = new CheckBox[]{ 232 | feScgCbox, feRachCbox, feRadioLinkCbox, feHandOverCbox 233 | }; 234 | mEventCheckBoxList = new ArrayList<>(Arrays.asList(checkBoxes)); 235 | for (CheckBox checkBox : mEventCheckBoxList) { 236 | checkBox.setOnCheckedChangeListener(mChangeListener); 237 | } 238 | } 239 | 240 | public void cancelAll() { 241 | for (CheckBox checkBox : mParamCheckBoxList) { 242 | checkBox.setChecked(false); 243 | textBlack(checkBox); 244 | } 245 | for (CheckBox checkBox : mEventCheckBoxList) { 246 | checkBox.setChecked(false); 247 | textBlack(checkBox); 248 | } 249 | } 250 | 251 | private void setTextChocolate(CompoundButton buttonView) { 252 | if (buttonView.getCurrentTextColor() == MyApplication.getContext().getColor(R.color.greenColor)) { 253 | // The color is green, indicating that it is reporting periodically 254 | return; 255 | } 256 | textChocolate(buttonView); 257 | } 258 | 259 | private void textChocolate(CompoundButton buttonView) { 260 | buttonView.setTextColor(getApplicationContext().getColor(R.color.chocolate)); 261 | } 262 | 263 | private void setTextBlack(CompoundButton buttonView) { 264 | if (buttonView.getCurrentTextColor() == MyApplication.getContext().getColor(R.color.greenColor)) { 265 | // The color is green, indicating that it is reporting periodically 266 | return; 267 | } 268 | textBlack(buttonView); 269 | } 270 | 271 | private void textBlack(CompoundButton buttonView) { 272 | buttonView.setTextColor(getApplicationContext().getColor(R.color.blackFont)); 273 | } 274 | } 275 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Huawei 5G Modem Kit Demo 2 | 3 | English | [中文](README_ZH.md) 4 | 5 | ## Table of Contents 6 | 7 | * [Introduction](#introduction) 8 | * [Getting Started](#getting-started) 9 | * [Supported Environments](#supported-environments) 10 | * [Result](#result) 11 | * [Technical Support](#technical-support) 12 | * [License](#license) 13 | 14 | ## Introduction 15 | 16 | The sample code encapsulates the Android API of the 5G Modem SDK and demonstrates how to use the 5G Modem Kit API to query modem parameters. 17 | 18 | ## Getting Started 19 | 20 | 1. Install Android Studio on your computer. 21 | 2. Open and run the sample project on your Android device. 22 | 23 | ## Supported Environments 24 | 25 | 1. Android SDK 26 or later and JDK 1.8 or later are recommended. 26 | 2. As the current version uses Java 8 language features, such as lambda expressions, configure compilation options for Gradle as follows: 27 | 28 | ``` 29 | compileOptions { 30 | sourceCompatibility JavaVersion.VERSION_1_8 31 | targetCompatibility JavaVersion.VERSION_1_8 32 | } 33 | ``` 34 | 35 | ## Result 36 | 37 | 38 | 39 | The following table details the modem parameters. The **Description** column describes the requested data of the corresponding modem parameter. 40 | 41 | | Abbreviation | Modem Parameter | Description | 42 | | --------- | ------------------------------------------------------------ | ----------------------------------------------------------- | 43 | | LTE | LTE = "LTE" | All Long-Term Evolution (LTE) information | 44 | | L.Arfcn | LTE_ARFCN = "LTE.arfcn" | LTE cell frequency | 45 | | L.PID | LTE_PHYCELLID = "LTE.phyCellId" | LTE physical cell ID (PCI) | 46 | | L.DF | LTE_DLFREQ = "LTE.dlFreq" | LTE downlink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) | 47 | | L.Band | LTE_BAND = "LTE.band" | LTE frequency band indicator | 48 | | L.Mimo | LTE_MIMO = "LTE.mimo" | Number of multiple-input multiple-output (MIMO) layers in an LTE cell | 49 | | L.DBW | LTE_DL_BANDWIDTH = "LTE.dlBandWidth" | LTE cell bandwidth | 50 | | L.LMT | LTE_LTE_MODE_TYPE = "LTE.lteModeType" | LTE cell mode | 51 | | L.TAC | LTE_TRACK_AREA_CODE = "LTE.trackAreaCode" | Tracking area code (TAC) information | 52 | | L.CID | LTE_CELL_IDENTITY = "LTE.cellIdentity" | Global cell ID (GCI) | 53 | | L.Mcc | LTE_MCC = "LTE.mcc" | Mobile country code (MCC) | 54 | | L.Mnc | LTE_MNC = "LTE.mnc" | Mobile network code (MNC) | 55 | | L.MCell | LTE_INTRA_EUTRA_CELL_MEAS_INFO = "LTE.measCell" | All LTE primary cell (PCell) measurements | 56 | | L.M.CID | LTE_INTRA_EUTRA_CELL_MEAS_INFO_CELLID = "LTE.measCell_cellId" | PCI of the LTE PCell | 57 | | L.M.Rsrp | LTE_INTRA_EUTRA_CELL_MEAS_INFO_RSRP = "LTE.measCell_rsrp" | Reference signal received power (RSRP) value of the LTE PCell 58 | | L.M.Rsrq | LTE_INTRA_EUTRA_CELL_MEAS_INFO_RSRQ = "LTE.measCell_rsrq" | Reference signal received quality (RSRQ) value of the LTE PCell | 59 | | L.M.Sinr | LTE_INTRA_EUTRA_CELL_MEAS_INFO_SINR = "LTE.measCell_sinr" | Signal-to-interference-plus-noise ratio (SINR) value of the LTE PCell | 60 | | L.Scell | LTE_SCELL = "LTE.scell" | All LTE secondary cell (SCell) measurements | 61 | | L.S.Arfcn | LTE_SCELL_arfcn = "LTE.scell_arfcn" | LTE SCell frequencies | 62 | | L.S.PID | LTE_SCELL_phyCellId = "LTE.scell_phyCellId" | PCIs of LTE SCells | 63 | | L.S.DF | LTE_SCELL_dlFreq = "LTE.scell_dlFreq" | LTE SCell downlink EARFCNs | 64 | | L.S.Band | LTE_SCELL_band = "LTE.scell_band" | LTE SCell frequency band indicators | 65 | | L.S.Mimo | LTE_SCELL_mimo = "LTE.scell_mimo" | Numbers of MIMO layers of LTE SCells | 66 | | L.S.DBW | LTE_SCELL_dlBandWidth = "LTE.scell_dlBandWidth" | LTE SCell bandwidths | 67 | | L.S.Rsrp | LTE_SCELL_rsrp = "LTE.scell_rsrp" | RSRP values of LTE SCells | 68 | | L.S.Rsrq | LTE_SCELL_rsrq = "LTE.scell_rsrq" | RSRQ values of LTE SCells | 69 | | L.S.Sinr | LTE_SCELL_sinr = "LTE.scell_sinr" | SINR values of LTE SCells | 70 | | NR | NR = "NR" | All New Radio (NR) information | 71 | | N.SPCInfo | NR_SPCELL_INFO = "NR.spCellInfo" | Spcell information | 72 | | N.SP.Basic | NR_SPCELL_BASIC = "NR.spCellInfo_basicInfo" | Basic information about the Spcell | 73 | | N.SP.Cfg | NR_SPCELL_CFG = "NR.spCellInfo_cfgInfo" | Configuration information about the Spcell | 74 | | N.SP.Meas | NR_SPCELL_MEAS = "NR.spCellInfo_measInfo " | measurements information about the Spcell | 75 | | N.SCInfo | NR_SCELL_INFO = "NR.sCellInfo" | NR SCell information | 76 | | N.S.Basic | NR_SCELL_BASIC = "NR.sCellInfo_basicInfo" | NR SCell Basic information | 77 | | N.S.Cfg | NR_SCELL_CFG = "NR.sCellInfo_cfgInfo" | NR SCell configuration | 78 | | N.S.SsbMeas | NR_SCELL_SSB_MEAS = "NR. sCellInfo_ssbMeasInfo " | NR SCell measurements | 79 | | NetDiagnosis | NET = "NETDIAGNOSIS" | Network diagnosis information | 80 | | ND.LTE | NET_LTE_INFO = "NETDIAGNOSIS.lteInfo" | LTE network diagnosis information | 81 | | ND.NR | NET_NR_INFO = "NETDIAGNOSIS.nrInfo" | NR network diagnosis information | 82 | | ND.L.RC | NET_LTE_REJ_CNT = "NETDIAGNOSIS.lteInfo_rejCnt" | Number of rejected LTE registration requests | 83 | | ND.L.RI | NET_LTE_REJ_INFOS = "NETDIAGNOSIS.lteInfo_rejInfos" | Detailed information about LTE registration rejection | 84 | | ND.L.PRC | NET_LTE_PDN_REJ_CNT = "NETDIAGNOSIS.lteInfo_pdnRejCnt" | Number of rejected LTE packet data network (PDN) connectivity requests | 85 | | ND.L.PRI | NET_LTE_PDN_REJ_INFOS = "NETDIAGNOSIS.lteInfo_pdnRejInfos" | LTE PDN connectivity rejection information | 86 | | ND.L.AC | NET_LTE_AMBR_CNT = "NETDIAGNOSIS.lteInfo_ambrCnt" | Number of aggregate maximum bit rates (AMBRs) of the LTE packet data unit (PDU) bearers | 87 | | ND.L.Ambrs | NET_LTE_AMBRS = "NETDIAGNOSIS.lteInfo_ambrs" | AMBR information corresponding to the default bearer | 88 | | ND.N.RC | NET_NR_REJ_CNT = "NETDIAGNOSIS.nrInfo_rejCnt" | Number of rejected NR registration requests | 89 | | ND.N.RI | NET_NR_REJ_INFO = "NETDIAGNOSIS.nrInfo_rejInfos" | Detailed information about NR registration rejection | 90 | | ND.N.PRC | NET_NR_PDU_REJ_CNT = "NETDIAGNOSIS.nrInfo_pduRejCnt" | Number of PDU session establishment rejections | 91 | | ND.N.PRI | NET_NR_PDU_REJ_INFO = "NETDIAGNOSIS. nrInfo_pduRejInfo" | PDU session establishment rejection information | 92 | | ND.N.AC | NET_NR_AMBR_CNT = "NETDIAGNOSIS.nrInfo_ambrCnt" | Number of PDU Session-AMBR messages | 93 | | ND.N.Ambrs | NET_NR_AMBR = "NETDIAGNOSIS. nrInfo_ambr" | NR Session-AMBR information | 94 | | FE.SCG | NET_NR_PDU_REJ_CNT = "NETDIAGNOSIS.nrInfo_pduRejCnt" | Enable for proactively reporting SCG failures | 95 | | FE.RACH | NET_NR_PDU_REJ_INFO = "NETDIAGNOSIS. nrInfo_pduRejInfo" | Enable for proactively reporting RACH failures | 96 | | FE.RL | NET_NR_AMBR_CNT = "NETDIAGNOSIS.nrInfo_ambrCnt" | Enable for proactively reporting radio link failures | 97 | | FE.HO | NET_NR_AMBR = "NETDIAGNOSIS. nrInfo_ambr" | Enable for proactively reporting handover failures | 98 | | Modem.Slice | NET_NR_AMBR = "NETDIAGNOSIS. nrInfo_ambr" | Modem system timestamp | 99 | | BEARER | BEARER = "BEARER" | All bearer information | 100 | | B.DInfo | BEARER_DRB_INFO = "BEARER.drbInfo" | All data radio bearer (DRB) information | 101 | | B.D.RbId | BEARER_RBID = "BEARER.drbInfo_rbId" | DRB IDs | 102 | | B.D.PVer | BEARER_PDCP_VERSION = "BEARER.drbInfo_pdcpVersion" | Packet Data Convergence Protocol (PDCP) versions | 103 | | B.D.BType | BEARER_BEARER_TYPE = "BEARER.drbInfo_bearerType" | Bearer types | 104 | | B.D.DST | BEARER_DATA_SPLIT_THRESHOLD = "BEARER.drbInfo_dataSplitThreshold" | Uplink data split threshold for user equipment (UE) | 105 | 106 | ## Technical Support 107 | 108 | If you want to evaluate more about HMS Core, [r/HMSCore on Reddit](https://www.reddit.com/r/HuaweiDevelopers/) is for you to keep up with latest news about HMS Core, and to exchange insights with other developers. 109 | 110 | If you have any questions about how to use HMS samples, try the following options: 111 | 112 | - [Stack Overflow](https://stackoverflow.com/questions/tagged/huawei-mobile-services?tab=Votes) is the best place for any programming questions. Be sure to tag your question with \[huawei-mobile-services]. 113 | - [The HMS Core module of HUAWEI Developer Forum](https://forums.developer.huawei.com/forumPortal/en/forum/hms-core?ha_source=hms1) is great for general questions, or seeking recommendations and opinions. 114 | 115 | If you run into a bug in our samples, please submit an [issue]() to the Repository. Even better you can submit a [Pull Request]() with a fix. 116 | 117 | ## License 118 | 119 | The 5G Modem Kit demo is licensed under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0). 120 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright 2020 HUAWEI 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_home_info.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 16 | 17 | 21 | 22 | 30 | 31 | 32 | 38 | 39 | 44 | 45 | 52 | 53 | 60 | 61 | 68 | 69 | 76 | 77 | 78 | 84 | 85 | 90 | 91 | 98 | 99 | 106 | 107 | 114 | 115 | 122 | 123 | 124 | 129 | 130 | 137 | 138 | 145 | 146 | 153 | 154 | 161 | 162 | 163 | 168 | 169 | 176 | 177 | 184 | 185 | 192 | 193 | 200 | 201 | 202 | 207 | 208 | 215 | 216 | 223 | 224 | 231 | 232 | 239 | 240 | 241 | 246 | 247 | 254 | 255 | 262 | 263 | 270 | 271 | 278 | 279 | 280 | 285 | 286 | 293 | 294 | 301 | 302 | 309 | 310 | 317 | 318 | 319 | 324 | 325 | 332 | 333 | 340 | 341 | 349 | 350 | 351 | 357 | 358 | 363 | 364 | 371 | 372 | 379 | 380 | 387 | 388 | 395 | 396 | 397 | 402 | 403 | 410 | 411 | 418 | 419 | 426 | 427 | 434 | 435 | 436 | 441 | 442 | 449 | 450 | 451 | 452 | 458 | 459 | 464 | 465 | 472 | 473 | 480 | 481 | 488 | 489 | 496 | 497 | 498 | 503 | 504 | 511 | 512 | 520 | 521 | 522 | 528 | 529 | 534 | 535 | 542 | 543 | 550 | 551 | 558 | 559 | 566 | 567 | 568 | 569 | 574 | 575 | 582 | 583 | 590 | 591 | 598 | 599 | 606 | 607 | 608 | 609 | 614 | 615 | 622 | 623 | 630 | 631 | 638 | 639 | 646 | 647 | 648 | 649 | 654 | 655 | 662 | 663 | 670 | 671 | 678 | 679 | 680 | 686 | 687 | 692 | 693 | 700 | 701 | 702 | 708 | 709 | 715 | 716 |