|  |  | 
 |  |  | import android.content.pm.PackageManager; | 
 |  |  | import android.content.res.Configuration; | 
 |  |  | import android.net.Uri; | 
 |  |  | import android.os.Build; | 
 |  |  | import android.os.Bundle; | 
 |  |  | import android.os.Process; | 
 |  |  | import android.provider.Settings; | 
 |  |  | import android.support.v4.content.PermissionChecker; | 
 |  |  | import android.view.View; | 
 |  |  | import android.widget.FrameLayout; | 
 |  |  | import android.widget.RelativeLayout; | 
 |  |  |  | 
 |  |  | import com.unity3d.player.UnityPlayerActivity; | 
 |  |  |  | 
 |  |  | 
 |  |  |     // 启用6.0以上权限回调code | 
 |  |  |     // private static final int CODE_REQUEST_PERMISSION = 1000; | 
 |  |  |  | 
 |  |  |     private RelativeLayout m_MainContainer; | 
 |  |  |     private int mType; | 
 |  |  |     private boolean isNotch = false; | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     protected void onCreate(Bundle savedInstanceState) | 
 |  |  |     { | 
 |  |  | 
 |  |  |         LogUtil.init(this, true); | 
 |  |  |  | 
 |  |  |         setContentView(R.layout.activity_main); | 
 |  |  |  | 
 |  |  |         m_MainContainer = (RelativeLayout) findViewById(R.id.main_container); | 
 |  |  |  | 
 |  |  |         String _brand = NotchPhoneUtil.getDeviceBrand(); | 
 |  |  |         if (_brand.toUpperCase().contains("VIVO")) | 
 |  |  |         { | 
 |  |  |             isNotch = NotchPhoneUtil.HasNotchVivo(MainActivity.this); | 
 |  |  |             mType = 1; | 
 |  |  |         } | 
 |  |  |         else if (_brand.toUpperCase().contains("HUAWEI") | 
 |  |  |                 || _brand.toUpperCase().contains("HONOR")) | 
 |  |  |         { | 
 |  |  | //            isNotch = NotchPhoneUtil.hasNotchAtHuawei(this);; | 
 |  |  | //            mType = 2; | 
 |  |  |         } | 
 |  |  |         else if (_brand.toUpperCase().contains("OPPO")) | 
 |  |  |         { | 
 |  |  |             isNotch = NotchPhoneUtil.HasNotchOPPO(MainActivity.this); | 
 |  |  |             mType = 3; | 
 |  |  |         } | 
 |  |  |         else if (_brand.toUpperCase().contains("XIAOMI")) | 
 |  |  |         { | 
 |  |  |             isNotch = NotchPhoneUtil.HasNotchXiaoMi(); | 
 |  |  |             mType = 4; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         NotchPhoneUtil.onConfigurationChanged(this, isNotch, mType, m_MainContainer); | 
 |  |  |  | 
 |  |  |         FrameLayout _frameLayout = (FrameLayout) findViewById(R.id.unity_view); | 
 |  |  |         View unityView = mUnityPlayer.getView(); | 
 |  |  | 
 |  |  |     @Override | 
 |  |  |     public void onConfigurationChanged(Configuration newConfig) | 
 |  |  |     { | 
 |  |  |         NotchPhoneUtil.onConfigurationChanged(this, isNotch, mType, m_MainContainer); | 
 |  |  |  | 
 |  |  |         H2EngineSDK.onConfigurationChanged(newConfig); | 
 |  |  |  | 
 |  |  |         super.onConfigurationChanged(newConfig); |