static void print_cur_config (void *data)
{
   struct android_app *android_app = (struct android_app*)data;
   char lang[2], country[2];
   AConfiguration_getLanguage(android_app->config, lang);
   AConfiguration_getCountry(android_app->config, country);

   RARCH_LOG("Config: mcc=%d mnc=%d lang=%c%c cnt=%c%c orien=%d touch=%d dens=%d "
         "keys=%d nav=%d keysHid=%d navHid=%d sdk=%d size=%d long=%d "
         "modetype=%d modenight=%d\n",
         AConfiguration_getMcc(android_app->config),
         AConfiguration_getMnc(android_app->config),
         lang[0], lang[1], country[0], country[1],
         AConfiguration_getOrientation(android_app->config),
         AConfiguration_getTouchscreen(android_app->config),
         AConfiguration_getDensity(android_app->config),
         AConfiguration_getKeyboard(android_app->config),
         AConfiguration_getNavigation(android_app->config),
         AConfiguration_getKeysHidden(android_app->config),
         AConfiguration_getNavHidden(android_app->config),
         AConfiguration_getSdkVersion(android_app->config),
         AConfiguration_getScreenSize(android_app->config),
         AConfiguration_getScreenLong(android_app->config),
         AConfiguration_getUiModeType(android_app->config),
         AConfiguration_getUiModeNight(android_app->config));
}
void AndroidConfiguration::reloadCacheForToString() {

  AConfiguration* config = mConfiguration.get();

  std::stringstream stream;

  char lang[2], country[2];
  AConfiguration_getLanguage(config, lang);
  AConfiguration_getCountry(config, country);

  stream << "Config: "
         << "mcc="       << AConfiguration_getMcc(config)         << " "
         << "mnc="       << AConfiguration_getMnc(config)         << " "
         << "lang="      << lang[0] << lang[1]                    << " "
         << "cnt="       << country[0] << country[1]              << " "
         << "orien="     << AConfiguration_getOrientation(config) << " "
         << "touch="     << AConfiguration_getTouchscreen(config) << " "
         << "dens="      << AConfiguration_getDensity(config)     << " "
         << "keys="      << AConfiguration_getKeyboard(config)    << " "
         << "nav="       << AConfiguration_getNavigation(config)  << " "
         << "keysHid="   << AConfiguration_getKeysHidden(config)  << " "
         << "navHid="    << AConfiguration_getNavHidden(config)   << " "
         << "sdk="       << AConfiguration_getSdkVersion(config)  << " "
         << "size="      << AConfiguration_getScreenSize(config)  << " "
         << "long="      << AConfiguration_getScreenLong(config)  << " "
         << "modetype="  << AConfiguration_getUiModeType(config)  << " "
         << "modenight=" << AConfiguration_getUiModeNight(config) << ""
         << "\n";
  mCacheForToString = stream.str();
}
Exemple #3
0
int TBSystem::GetDPI()
{
	AConfiguration *config = AConfiguration_new();
	AConfiguration_fromAssetManager(config, g_pManager);
	int32_t density = AConfiguration_getDensity(config);
	AConfiguration_delete(config);
	if (density == 0 || density == ACONFIGURATION_DENSITY_NONE)
		return 120;
	return density;
}
Exemple #4
0
unsigned int VID_GetSysModes( vidmode_t *modes )
{
	ANativeWindow *window = sys_android_app->window;
	int windowWidth, windowHeight;
	int density;
	float densityStep;
	int i;

	if( !window )
		return 0;

	windowWidth = ANativeWindow_getWidth( window );
	windowHeight = ANativeWindow_getHeight( window );
	if( windowHeight > windowWidth )
	{
		// The window may be created in portrait orientation sometimes, for example, when launching in sleep mode.
		int tempWidth = windowWidth;
		windowWidth = windowHeight;
		windowHeight = tempWidth;
	}

	if( windowHeight <= 480 )
	{
		if( modes )
		{
			modes[0].width = windowWidth;
			modes[0].height = windowHeight;
		}
		return 1;
	}

	density = AConfiguration_getDensity( sys_android_app->config );
	if( !density )
		density = ACONFIGURATION_DENSITY_MEDIUM;
	densityStep = 1.0f - ( float )( density - 40 ) / ( float )density;

	for( i = 0; ; i++ )
	{
		float scale = 1.0f - densityStep * ( float )i;
		int width = windowWidth * scale;
		int height = windowHeight * scale;

		if( ( width <= 0 ) || ( height < 480 ) )
			break;

		if( modes )
		{
			modes[i].width = width;
			modes[i].height = height;
		}
	}

	return i;
}
int PlatformUtils::getDPI()
{
    AConfiguration *config = AConfiguration_new();
    AConfiguration_fromAssetManager(config, AndroidServices::getAAssetManager());
    int32_t density = AConfiguration_getDensity(config);
    AConfiguration_delete(config);

    if (density == 0 || density == ACONFIGURATION_DENSITY_NONE)
        return 120;

    return density;
}
Exemple #6
0
float VID_GetPixelRatio( void ) {
	static float invDensity;
	int height;
	int windowWidth, windowHeight;

	if( !sys_android_app->window || !viddef.height ) {
		return 1.0f;
	}

	if( !invDensity ) {
		float density = AConfiguration_getDensity( sys_android_app->config ) * ( 1.0f / ( float )ACONFIGURATION_DENSITY_MEDIUM );
		if( !density ) {
			density = 1.0f / ( float )ACONFIGURATION_DENSITY_MEDIUM;
		}
		invDensity = 1.0f / density;
	}

	windowWidth = ANativeWindow_getWidth( sys_android_app->window );
	windowHeight = ANativeWindow_getHeight( sys_android_app->window );
	return ( float )viddef.height / ( ( float )( min( windowWidth, windowHeight ) ) * invDensity );
}
Exemple #7
0
void StAndroidGlue::printConfig() {
    char aLang[3], aCountry[3];
    AConfiguration_getLanguage(myConfig, aLang);
    AConfiguration_getCountry (myConfig, aCountry);
    aLang[2]    = '\0';
    aCountry[2] = '\0';
    ST_DEBUG_LOG("Config:"
               + " mcc="       + AConfiguration_getMcc(myConfig)
               + " mnc="       + AConfiguration_getMnc(myConfig)
               + " lang="      + aLang + " cnt=" + aCountry
               + " orien="     + AConfiguration_getOrientation(myConfig)
               + " touch="     + AConfiguration_getTouchscreen(myConfig)
               + " dens="      + AConfiguration_getDensity    (myConfig)
               + " keys="      + AConfiguration_getKeyboard   (myConfig)
               + " nav="       + AConfiguration_getNavigation (myConfig)
               + " keysHid="   + AConfiguration_getKeysHidden (myConfig)
               + " navHid="    + AConfiguration_getNavHidden  (myConfig)
               + " sdk="       + AConfiguration_getSdkVersion (myConfig)
               + " size="      + AConfiguration_getScreenSize (myConfig)
               + " long="      + AConfiguration_getScreenLong (myConfig)
               + " modetype="  + AConfiguration_getUiModeType (myConfig)
               + " modenight=" + AConfiguration_getUiModeNight(myConfig));
}
Exemple #8
0
void StAndroidGlue::updateMonitors() {
    if(myConfig == NULL) {
        return;
    }

    const int32_t aWidthDp  = AConfiguration_getScreenWidthDp (myConfig);
    const int32_t aHeightDp = AConfiguration_getScreenHeightDp(myConfig);
    const int32_t aDpi      = AConfiguration_getDensity       (myConfig);

    StMonitor aMon;
    aMon.setId(0);
    if(myStereoApiId == "S3DV") {
        aMon.setPnPId("ST@S3DV");
    }
    aMon.changeVRect().top()    = 0;
    aMon.changeVRect().left()   = 0;
    aMon.changeVRect().right()  = (int )(0.5 + double(aWidthDp ) * (double(aDpi) / 160.0));
    aMon.changeVRect().bottom() = (int )(0.5 + double(aHeightDp) * (double(aDpi) / 160.0));

    aMon.setOrientation(AConfiguration_getOrientation(myConfig) == ACONFIGURATION_ORIENTATION_PORT
                      ? StMonitor::Orientation_Portrait : StMonitor::Orientation_Landscape);
    aMon.setScale(float(double(aDpi) / 160.0));
    StSearchMonitors::setupGlobalDisplay(aMon);
}
void GestureDetector::SetConfiguration(AConfiguration* config) {
  dp_factor_ = 160.f / AConfiguration_getDensity(config);
}
void DoubletapDetector::SetConfiguration(AConfiguration* config) {
  dp_factor_ = 160.f / AConfiguration_getDensity(config);
  tap_detector_.SetConfiguration(config);
}
Exemple #11
0
// Configurationを表示する
void displayConfiguration(struct engine* engine) {
    int idx = 0;
    // 画面の向き
    const char orientation_list[][32] = {
        "ORIENTATION_ANY",   // 未定義
        "ORIENTATION_PORT",  // Portrait
        "ORIENTATION_LAND",  // Landcape
        "ORIENTATION_SQUARE" // Square
    };
    // タッチスクリーン
    const char touchscreen_list[][32] = {
        "TOUCHSCREEN_ANY",    // 未定義
        "TOUCHSCREEN_NOTOUCH",// タッチスクリーンではない
        "TOUCHSCREEN_STYLUS", // (廃止)
        "TOUCHSCREEN_FINGER"  // タッチスクリーン
    };
    // キーボード
    const char keyboard_list[][32] = {
        "KEYBOARD_ANY",    // 未定義
        "KEYBOARD_NOKEYS", // キーはない
        "KEYBOARD_QWERTY", // QWERTY配列
        "KEYBOARD_12KEY"   // 12キー
    };
    // ナビゲーション
    const char navigation_list[][32] = {
        "NAVIGATION_ANY",   // 未定義
        "NAVIGATION_NONAV", // なし
        "NAVIGATION_DPAD",  // DPAD
        "NAVIGATION_TRACKBALL", // トラックボール
        "NAVIGATION_WHEEL"  // ホイール
    };
    // ソフトウェアキーボード
    const char keyshidden_list[][32] = {
        "KEYSHIDDEN_ANY", // 未定義
        "KEYSHIDDEN_NO",  // キーボードを隠すことができない
        "KEYSHIDDEN_YES", // キーボードを隠すことができる
        "KEYSHIDDEN_SOFT" // ソフト制御
    };
    // ナビゲーションキーの隠し方
    const char navhidden_list[][32] = {
        "NAVHIDDEN_ANY", // 未定義
        "NAVHIDDEN_NO",  // ナビゲーションキーを隠すことができる
        "NAVHIDDEN_YES"  // ナビゲーションキーを隠すことができない
    };
    // 画面サイズ
    const char screensize_list[][32] = {
        "SCREENSIZE_ANY",    // 未定義
        "SCREENSIZE_SMALL",  // 小さい
        "SCREENSIZE_NORMAL", // 標準
        "SCREENSIZE_LARGE",  // 大きい
        "SCREENSIZE_XLARGE"  // 特大
    };
    // ワイドスクリーンか
    const char screenlong_list[][32] = {
        "SCREENLONG_ANY",  // 未定義
        "SCREENLONG_NO",   // ワイドではない(QVGA,HVGA,VGAなど)
        "SCREENLONG_YES",  // ワイドである(WQVGA,WVGA,FWVGAなど)
    };
    // 接続状態
    const char uimodetype_list[][32] = {
        "UI_MODE_TYPE_ANY",    // 未定義
        "UI_MODE_TYPE_NORMAL", // 標準
        "UI_MODE_TYPE_DESK",   // DeskDocに接続中
        "UI_MODE_TYPE_CAR"     // CarDocに接続中
    };
    // UIモード(夜)タイプ
    const char uimodenight_list[][32] = {
        "UI_MODE_NIGHT_ANY", // 未定義
        "UI_MODE_NIGHT_NO",  // 昼モード
        "UI_MODE_NIGHT_YES"  // 夜モード
    };

    // 言語を取得(2文字が返る)
    char language[3] = { 0 };
    AConfiguration_getLanguage(engine->app->config, language);
    LOGI("Language:%s", language);
    // 国を取得(2文字が返る)
    char country[3] = { 0 };
    AConfiguration_getCountry(engine->app->config, country);
    LOGI("Country:%s", country);
    // 画面の向き
    idx = AConfiguration_getOrientation(engine->app->config);
    LOGI("Orientation:%s", orientation_list[idx]);
    // タッチスクリーン
    idx = AConfiguration_getTouchscreen(engine->app->config);
    LOGI("Touchscreen:%s", touchscreen_list[idx]);
    // 解像度
    int density = AConfiguration_getDensity(engine->app->config);
    LOGI("Density:%d", density);
    // キーボード
    idx = AConfiguration_getKeyboard(engine->app->config);
    LOGI("Keyboard:%s", keyboard_list[idx]);
    // ナビゲーション
    idx = AConfiguration_getNavigation(engine->app->config);
    LOGI("Navigation:%s", keyboard_list[idx]);
    // キーの隠し方
    idx = AConfiguration_getKeysHidden(engine->app->config);
    LOGI("KeysHidden:%s", keyshidden_list[idx]);
    // ナビゲーションキーの隠し方
    idx = AConfiguration_getNavHidden(engine->app->config);
    LOGI("NaviHidden:%s", navhidden_list[idx]);
    // SDK(API)バージョン
    int ver = AConfiguration_getSdkVersion(engine->app->config);
    LOGI("SdkVersion:%d", ver);
    // スクリーンサイズ
    idx = AConfiguration_getScreenSize(engine->app->config);
    LOGI("ScreenSize:%s", screensize_list[idx]);
    // ワイドスクリーンか
    idx = AConfiguration_getScreenLong(engine->app->config);
    LOGI("ScreenLong:%s", screenlong_list[idx]);
    // UIモードタイプ
    idx = AConfiguration_getUiModeType(engine->app->config);
    LOGI("UiModeType:%s", uimodetype_list[idx]);
    // UIモード(夜)タイプ
    idx = AConfiguration_getUiModeNight(engine->app->config);
    LOGI("UiModeNight:%s", uimodenight_list[idx]);
}