闹钟界面会先出现解锁界面

进入“Clock”,点闹钟图标,会先出现解锁界面,解锁后才出现闹钟定义界面。
不插3G模块,不会出现此现象,而插入3G模块后,会在检测完未插卡后出现此现象。

ic_clock_strip_alarm
res/layout/desk_clock_buttons.xml:        android:src="@drawable/ic_clock_strip_alarm"
    <ImageButton android:id="@+id/alarm_button"
                style="@style/ButtonStripLeft"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:layout_weight=".25"
        android:src="@drawable/ic_clock_strip_alarm"
        android:contentDescription="@string/alarm_button_description"
        />

src/com/android/deskclock/DeskClock.java:        final ImageButton alarmButton = (ImageButton) findViewById(R.id.alarm_button);
final ImageButton alarmButton = (ImageButton) findViewById(R.id.alarm_button);
alarmButton.setOnClickListener(alarmClickListener);

startActivity(new Intent(DeskClock.this, AlarmClock.class));

ATTACHED TO WINDOW
D/LockScreen(   86): updateLayout: status=SimMissing

Settings.Secure.DEVICE_PROVISIONED
            //jeff
            loadIntegerSetting(stmt, Settings.Secure.DEVICE_PROVISIONED,
                    R.integer.def_device_provisioned);

mKeyguardView.requestFocus();
public synchronized void verifyUnlock() {
private void handleShow() {
private void showLocked() {
    public void setKeyguardEnabled(boolean enabled) {
    private void doKeyguard() {
    public void onScreenTurnedOff(int why) {
DELAYED_KEYGUARD_ACTION
TelephonyManager.ACTION_PHONE_STATE_CHANGED

src/com/android/deskclock/DeskClock.java
frameworks/base/policy/src/com/android/internal/policy/impl/LockScreen.java
frameworks/base/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
frameworks/base/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

    private void updateLockScreenTimeout() {
            Log.d(TAG, "[jeff]updateLockScreenTimeout() enable:"+enable);
            Log.d(TAG, "[jeff]updateLockScreenTimeout() mAllowLockscreenWhenOn:"+mAllowLockscreenWhenOn+",mScreenOn:"+mScreenOn+",mKeyguardMe
diator.isSecure():"+mKeyguardMediator.isSecure());

D/WindowManager(   86): [jeff]updateLockScreenTimeout() enable:false
D/WindowManager(   86): [jeff]updateLockScreenTimeout() mAllowLockscreenWhenOn:false,mScreenOn:true,mKeyguardMediator.isSecure():true
D/WindowManager(   86): [jeff]updateLockScreenTimeout() enable:true
D/WindowManager(   86): [jeff]updateLockScreenTimeout() mAllowLockscreenWhenOn:true,mScreenOn:true,mKeyguardMediator.isSecure():true

可以看出是由于mAllowLockscreenWhenOn变化导致,而赋值在:
    public void animatingWindowLw(WindowState win,
                                WindowManager.LayoutParams attrs) {

                if ((attrs.flags & FLAG_ALLOW_LOCK_WHILE_SCREEN_ON) != 0) {
                    mAllowLockscreenWhenOn = true;
                }
    }

所以在packages/apps/目录下搜索,确实deskclock中有加入这个属性FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
jeff@translogic:~/android/iputer-2.3.7/jeff-2.3.7_r1$ grep "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON" packages/apps/ -r --include=*.java
packages/apps/DeskClock/src/com/android/deskclock/AlarmAlertFullScreen.java:                    | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);
packages/apps/DeskClock/src/com/android/deskclock/DeskClock.java:                | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
packages/apps/CellBroadcastReceiver/src/com/android/cellbroadcastreceiver/CellBroadcastAlertDialog.java:                    | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);

将这3个都屏蔽。 问题解决。

你可能感兴趣的:(android,layout,button)