华为P Smart 2019中的虚拟陀螺仪phone?

Virtual Gyroscope in Huawei P Smart 2019 phone?

我有 Huawei P Smart 2019 智能手机。大多数有规格的网站(包括华为官方网站)都说这个型号没有陀螺仪

但我使用 Sensor Fusion 应用测试了 Huawei P Smart 2019。此应用可检测陀螺仪传感器并展示其工作原理。

What's the issue? Why even manufacturer says there's no gyroscope sensor in Huawei P Smart 2019 although a sensor clearly exists there?

也许是 virtual gyroscope

package org.hitlabnz.sensor_fusion_demo;

public class SensorSelectionActivity extends FragmentActivity {
    SectionsPagerAdapter mSectionsPagerAdapter;
    ViewPager mViewPager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sensor_selection);
        mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
        mViewPager = (ViewPager) findViewById(R.id.pager);
        mViewPager.setAdapter(mSectionsPagerAdapter);

        SensorChecker checker = new HardwareChecker((SensorManager) getSystemService(SENSOR_SERVICE));
        if(!checker.IsGyroscopeAvailable()) {
            displayHardwareMissingWarning();
        }
    }
    private void displayHardwareMissingWarning() {
        AlertDialog ad = new AlertDialog.Builder(this).create();  
        ad.setCancelable(false);   
        ad.setTitle(getResources().getString(R.string.gyroscope_missing)); 
        ad.setMessage(getResources().getString(R.string.gyroscope_missing_message));

        ad.setButton(DialogInterface.BUTTON_NEUTRAL, getResources().getString(R.string.OK), new DialogInterface.OnClickListener() {  
            @Override  
            public void onClick(DialogInterface dialog, int which) {   
                dialog.dismiss();                      
            }  
        });  
        ad.show();  
    }
}

关于其工作原理的一些解释:https://android.gadgethacks.com/how-to/use-google-cardboard-if-your-phone-doesnt-have-gyroscope-0172650/

借助智能手机上的指南针和加速度计传感器,您可以制作一个虚拟陀螺仪。您需要从罗盘和加速度计获取数据并进行大量工作并对其进行分类,但您可以用它虚拟地处理陀螺仪功能:-)