12372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn/* 22372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn * Copyright (C) 2011 The Android Open Source Project 32372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn * 42372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn * Licensed under the Apache License, Version 2.0 (the "License"); 52372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn * you may not use this file except in compliance with the License. 62372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn * You may obtain a copy of the License at 72372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn * 82372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn * http://www.apache.org/licenses/LICENSE-2.0 92372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn * 102372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn * Unless required by applicable law or agreed to in writing, software 112372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn * distributed under the License is distributed on an "AS IS" BASIS, 122372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 132372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn * See the License for the specific language governing permissions and 142372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn * limitations under the License. 152372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn */ 162372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn 172372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackbornpackage com.android.settings.applications; 182372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn 192372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackbornimport android.content.pm.ActivityInfo; 202372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackbornimport android.content.res.Configuration; 212372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackbornimport android.content.res.Resources; 222372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn 232372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackbornclass InterestingConfigChanges { 242372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn final Configuration mLastConfiguration = new Configuration(); 252372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn int mLastDensity; 262372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn 272372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn boolean applyNewConfig(Resources res) { 282372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn int configChanges = mLastConfiguration.updateFrom(res.getConfiguration()); 292372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn boolean densityChanged = mLastDensity != res.getDisplayMetrics().densityDpi; 302372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn if (densityChanged || (configChanges&(ActivityInfo.CONFIG_LOCALE 312372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn |ActivityInfo.CONFIG_UI_MODE|ActivityInfo.CONFIG_SCREEN_LAYOUT)) != 0) { 322372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn mLastDensity = res.getDisplayMetrics().densityDpi; 332372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn return true; 342372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn } 352372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn return false; 362372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn } 372372ba5b54f018cbc2e01f66b661c2e322d174d7Dianne Hackborn} 38