注:谨以此文表达对某大企业鸡蛋里挑骨头的作风表示强列不满!
软件需求变更是常有的事,当然有些合理,有此不合理,如何判断就见仁见智了
先上图:
先说明下,这是android4.2锁屏的界面。左边是4.2的新特性,可以添加WIDGET。
问题:唤醒屏时不应该有这个显示
首先,了解下为什么会有“这个”显示
代码在:
frameworks/base/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java private Runnable mHideHintsRunnable = new Runnable() { @Override public void run() { if (mKeyguardWidgetPager != null) { mKeyguardWidgetPager.hideOutlinesAndSidePages(); } } }; public void showUsabilityHints() { mMainQueue.postDelayed( new Runnable() { @Override public void run() { mKeyguardSecurityContainer.showUsabilityHint(); } } , SCREEN_ON_RING_HINT_DELAY); mKeyguardWidgetPager.showInitialPageHints(); if (mHideHintsRunnable != null) { mMainQueue.postDelayed(mHideHintsRunnable, SCREEN_ON_RING_HINT_DELAY);//改嘛,就在这里,SCREEN_ON_RING_HINT_DELAY 改为 0 } }
看下实现的流程:
mKeyguardWidgetPager.hideOutlinesAndSidePages()//要去找这里.
frameworks/base/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java
void hideOutlinesAndSidePages() { animateOutlinesAndSidePages(false); } void animateOutlinesAndSidePages(final boolean show) { animateOutlinesAndSidePages(show, -1); } void animateOutlinesAndSidePages(final boolean show, int duration) { if (mChildrenOutlineFadeAnimation != null) { mChildrenOutlineFadeAnimation.cancel(); mChildrenOutlineFadeAnimation = null; } int count = getChildCount(); PropertyValuesHolder alpha; ArrayList<Animator> anims = new ArrayList<Animator>(); if (duration == -1) { duration = show ? CHILDREN_OUTLINE_FADE_IN_DURATION : CHILDREN_OUTLINE_FADE_OUT_DURATION; } int curPage = getNextPage(); for (int i = 0; i < count; i++) { float finalContentAlpha; if (show) { finalContentAlpha = getAlphaForPage(mScreenCenter, i, true); } else if (!show && i == curPage) { finalContentAlpha = 1f; } else { finalContentAlpha = 0f; } KeyguardWidgetFrame child = getWidgetPageAt(i); alpha = PropertyValuesHolder.ofFloat("contentAlpha", finalContentAlpha); ObjectAnimator a = ObjectAnimator.ofPropertyValuesHolder(child, alpha); anims.add(a); float finalOutlineAlpha = show ? getOutlineAlphaForPage(mScreenCenter, i, true) : 0f; child.fadeFrame(this, show, finalOutlineAlpha, duration); } mChildrenOutlineFadeAnimation = new AnimatorSet(); mChildrenOutlineFadeAnimation.playTogether(anims); mChildrenOutlineFadeAnimation.setDuration(duration); mChildrenOutlineFadeAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { if (show) { enablePageContentLayers(); } } @Override public void onAnimationEnd(Animator animation) { if (!show) { disablePageContentLayers(); KeyguardWidgetFrame frame = getWidgetPageAt(mWidgetToResetAfterFadeOut); if (frame != null && !(frame == getWidgetPageAt(mCurrentPage) && mViewStateManager.isChallengeOverlapping())) { frame.resetSize(); } mWidgetToResetAfterFadeOut = -1; mShowingInitialHints = false; } updateWidgetFramesImportantForAccessibility(); } }); mChildrenOutlineFadeAnimation.start(); }
没什么特别的,就是改了下显示的时间,把延迟改为0。
是功能是BUG,大家一看就明了。